package router

import (
	// "fmt"

	// "github.com/engigu/taskpool/internal/constant"
	"github.com/engigu/taskpool/internal/eventbus"
	// "github.com/engigu/taskpool/internal/logger"
	// "github.com/engigu/taskpool/internal/models"
	"github.com/engigu/taskpool/internal/services"
	"github.com/engigu/taskpool/internal/executor"
)

func setupEventHandlers(subscribers ...eventbus.Subscriber) {
	bus := eventbus.DefaultBus

	// 遍历并统一初始化所有订阅者的事件链路
	for _, s := range subscribers {
		s.SubscribeEvents(bus)
	}
}

func startAppLogCleanup(appLogSvc *services.AppLogService) {
	// 注册到内部系统定时器（并立即执行第一次）
	executor.GetSysCron().AddJobWithRun("@every 1h", func() {
		appLogSvc.CleanUp()
	})
}
