feat(archied): run daemon maintenance as built-in schedules
This commit is contained in:
3 files changed
+36
-13
No files matched your search
@@ -448,6 +448,12 @@ func (d *Daemon) pollIssuesWithConfig(ctx context.Context, fg forge.Forge, cfg c
|
||||
func (d *Daemon) RunOnce(ctx context.Context) {
|
||||
defer d.WaitForTasks()
|
||||
d.watchCallWaits(ctx)
|
||||
// One pass has no scheduler, so it runs the maintenance jobs itself.
|
||||
for _, job := range d.BuiltinJobs() {
|
||||
if err := job.Run(ctx); err != nil {
|
||||
d.Log.WarnContext(ctx, "built-in job failed", "job", job.ID, "err", err)
|
||||
}
|
||||
}
|
||||
d.Cycle(ctx)
|
||||
if d.Tasks == nil {
|
||||
return
|
||||
@@ -465,15 +471,10 @@ func (d *Daemon) RunOnce(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Cycle is one poll pass: run every built-in job, then turn captured events
|
||||
// and review reactions into tasks. Draining queued tasks is the caller's job
|
||||
// Cycle is one poll pass: turn captured events and review reactions into
|
||||
// tasks; maintenance runs as built-in schedules. Draining queued tasks is the caller's job
|
||||
// (drainLoop in Run, drainNATS in RunOnce) so there is one drainer.
|
||||
func (d *Daemon) Cycle(ctx context.Context) {
|
||||
for _, job := range d.BuiltinJobs() {
|
||||
if err := job.Run(ctx); err != nil {
|
||||
d.Log.WarnContext(ctx, "built-in job failed", "job", job.ID, "err", err)
|
||||
}
|
||||
}
|
||||
d.dispatchBindings(ctx)
|
||||
d.drainReactions(ctx)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user