Run reviews and nudges on the state-driven coordinator
This commit is contained in:
@@ -11,6 +11,11 @@ type Work struct {
|
||||
FinalizeMerges []FinalizingMerge
|
||||
StartDiscards []string
|
||||
FinishDiscards []string
|
||||
EndReviewers []EndedReviewer
|
||||
StartReviews []SnapshotRef
|
||||
StartStages []StageStart
|
||||
SettleReviews []SnapshotRef
|
||||
ReadyPrompts []ReadyPrompt
|
||||
}
|
||||
|
||||
func (s *Store) Coordinate(ctx context.Context) (Work, error) {
|
||||
@@ -44,6 +49,26 @@ func (s *Store) Coordinate(ctx context.Context) (Work, error) {
|
||||
return err
|
||||
}
|
||||
work.FinishDiscards, err = queryIDs(ctx, tx, `SELECT id FROM tasks WHERE status = 'active' AND discard_state = 'closing'`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
work.EndReviewers, err = endReviews(ctx, tx, emit)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
work.StartReviews, err = startableReviews(ctx, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
work.StartStages, err = pendingStages(ctx, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
work.SettleReviews, err = settleReviews(ctx, tx, work.StartStages)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
work.ReadyPrompts, err = readyPrompts(ctx, tx, emit)
|
||||
return err
|
||||
})
|
||||
return work, err
|
||||
|
||||
Reference in New Issue
Block a user