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
+3 -2
View File
@@ -15,8 +15,9 @@ import (
"github.com/Rain-kl/Wavelet/pkg/logger"
)
func init() {
task.OnTaskCompleted = handleTaskCompleted
// RegisterTaskListeners subscribes push notification handlers to task completion events.
func RegisterTaskListeners() {
task.OnTaskCompleted(handleTaskCompleted)
}
// handleTaskCompleted handles task completions and triggers appropriate push events.