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:
ryan
2026-06-18 10:34:49 +08:00
parent 6066eb114b
commit 22c2ad5c73
8 changed files with 99 additions and 21 deletions
+2
View File
@@ -9,6 +9,7 @@ import (
"log"
"sync"
"github.com/Rain-kl/Wavelet/internal/bootstrap"
"github.com/Rain-kl/Wavelet/internal/router"
"github.com/Rain-kl/Wavelet/internal/task/scheduler"
"github.com/Rain-kl/Wavelet/internal/task/worker"
@@ -20,6 +21,7 @@ var allCmd = &cobra.Command{
Short: "以融合模式同时启动 API、Worker 和 Scheduler",
Run: func(_ *cobra.Command, _ []string) {
log.Println("[All] 融合模式启动")
bootstrap.RegisterAll()
var wg sync.WaitGroup