diff options
Diffstat (limited to 'services/actions')
-rw-r--r-- | services/actions/init.go | 2 | ||||
-rw-r--r-- | services/actions/job_emitter.go | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/services/actions/init.go b/services/actions/init.go index 3fd03eeb6f..8a9a30084a 100644 --- a/services/actions/init.go +++ b/services/actions/init.go @@ -15,7 +15,7 @@ func Init() { return } - jobEmitterQueue = queue.CreateUniqueQueue("actions_ready_job", jobEmitterQueueHandle, new(jobUpdate)) + jobEmitterQueue = queue.CreateUniqueQueue("actions_ready_job", jobEmitterQueueHandler) go graceful.GetManager().RunWithShutdownFns(jobEmitterQueue.Run) notification.RegisterNotifier(NewNotifier()) diff --git a/services/actions/job_emitter.go b/services/actions/job_emitter.go index c6b6fc551e..f7ec615364 100644 --- a/services/actions/job_emitter.go +++ b/services/actions/job_emitter.go @@ -16,7 +16,7 @@ import ( "xorm.io/builder" ) -var jobEmitterQueue queue.UniqueQueue +var jobEmitterQueue *queue.WorkerPoolQueue[*jobUpdate] type jobUpdate struct { RunID int64 @@ -32,13 +32,12 @@ func EmitJobsIfReady(runID int64) error { return err } -func jobEmitterQueueHandle(data ...queue.Data) []queue.Data { +func jobEmitterQueueHandler(items ...*jobUpdate) []*jobUpdate { ctx := graceful.GetManager().ShutdownContext() - var ret []queue.Data - for _, d := range data { - update := d.(*jobUpdate) + var ret []*jobUpdate + for _, update := range items { if err := checkJobsOfRun(ctx, update.RunID); err != nil { - ret = append(ret, d) + ret = append(ret, update) } } return ret |