mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 23:56:37 +08:00
refactor(task): replace init registration with bootstrap wiring
Introduce internal/bootstrap as the composition root with sync.Once guards for task handler registration and push listener wiring. Replace the single OnTaskCompleted global hook with multi-subscriber handlers and remove init()-driven side effects from worker, admin task, and push.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Rain-kl/Wavelet/internal/bootstrap"
|
||||
"github.com/Rain-kl/Wavelet/internal/model"
|
||||
"github.com/Rain-kl/Wavelet/internal/task"
|
||||
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||
@@ -32,6 +33,8 @@ func GetAsynqClient() *asynq.Client {
|
||||
|
||||
// StartScheduler 启动调度器 (该函数阻塞,直到调度器退出)
|
||||
func StartScheduler() error {
|
||||
bootstrap.RegisterScheduler()
|
||||
|
||||
var err error
|
||||
schedulerOnce.Do(func() {
|
||||
quitChan = make(chan struct{})
|
||||
|
||||
Reference in New Issue
Block a user