feat: implement brand asset cleanup event handling and reconciliation logic
Backend CI / Backend (push) Failing after 6m54s

This commit is contained in:
2026-06-21 08:26:56 +08:00
parent 05a69c7c89
commit c1b06dab18
11 changed files with 744 additions and 15 deletions
+9
View File
@@ -124,6 +124,8 @@ func main() {
WithCache(app.Cache)
monitoringRetentionWorker := internalscheduler.NewMonitoringRetentionWorker(app.MonitoringDB, app.Logger)
brandAssetCleanupWorker := internalscheduler.NewBrandAssetCleanupWorker(app.DB, app.MonitoringDB, app.Cache, app.Logger)
brandAssetCleanupEventWorker := internalscheduler.NewBrandAssetCleanupEventWorker(brandAssetCleanupWorker, app.DB, app.Logger)
brandAssetCleanupReconcileWorker := internalscheduler.NewBrandAssetCleanupReconcileWorker(app.DB, app.Logger)
aiPointUsageCleanupWorker := internalscheduler.NewAIPointUsageCleanupWorker(app.DB, app.Logger)
schedulerRunRetentionWorker := internalscheduler.NewSchedulerRunRetentionWorker(app.DB, app.Logger)
@@ -188,6 +190,12 @@ func main() {
return brandAssetCleanupWorker.RunOnce(runCtx, jobCtx)
},
},
{
Key: "brand_asset_cleanup_reconcile",
Run: func(runCtx context.Context, jobCtx internalscheduler.JobRunContext) (map[string]any, error) {
return brandAssetCleanupReconcileWorker.RunOnce(runCtx, jobCtx)
},
},
{
Key: "ai_point_usage_cleanup",
Run: func(runCtx context.Context, jobCtx internalscheduler.JobRunContext) (map[string]any, error) {
@@ -215,6 +223,7 @@ func main() {
},
})
startSchedulerWorker(ctx, &workerWG, "control_plane", app.Logger.Sugar(), controlPlane.Run)
startSchedulerWorker(ctx, &workerWG, "brand_asset_cleanup_events", app.Logger.Sugar(), brandAssetCleanupEventWorker.Run)
var metricsServer *http.Server
if app.Config().Scheduler.HTTPPort > 0 {