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
-5
View File
@@ -13,7 +13,6 @@ import ("fmt"
"github.com/Rain-kl/Wavelet/internal/apps/admin"
"github.com/Rain-kl/Wavelet/internal/model"
"github.com/Rain-kl/Wavelet/internal/task"
taskhandlers "github.com/Rain-kl/Wavelet/internal/task/handlers"
"github.com/Rain-kl/Wavelet/internal/task/scheduler"
"github.com/Rain-kl/Wavelet/pkg/logger"
"github.com/gin-gonic/gin"
@@ -21,10 +20,6 @@ import ("fmt"
"github.com/Rain-kl/Wavelet/internal/common/response")
func init() {
taskhandlers.Register()
}
// ListTaskTypes 获取支持的任务类型列表
// @Summary 获取支持的任务类型
// @Description 返回系统支持的所有可调度任务类型列表,包括任务名称、描述、是否支持时间范围等元数据,需要管理员权限