feat(schedule): support KOL subscription targets and random time windows
Frontend CI / Frontend (push) Successful in 3m37s
Backend CI / Backend (push) Failing after 6m47s

Extend schedule tasks to dispatch KOL subscription prompts in addition
to prompt rules, add daily/weekly scheduling with fixed or random time
windows, and track dispatch outcomes (last run, status, consecutive
failures).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 23:51:45 +08:00
parent 9cc6537e68
commit c28c4f1419
20 changed files with 3034 additions and 329 deletions
+13 -1
View File
@@ -19,6 +19,7 @@ import (
internalscheduler "github.com/geo-platform/tenant-api/internal/scheduler"
"github.com/geo-platform/tenant-api/internal/shared/response"
tenantapp "github.com/geo-platform/tenant-api/internal/tenant/app"
"github.com/geo-platform/tenant-api/internal/tenant/repository"
generateworker "github.com/geo-platform/tenant-api/internal/worker/generate"
"github.com/gin-gonic/gin"
)
@@ -63,6 +64,17 @@ func main() {
generationCfg,
app.Config().LLM.MaxOutputTokens,
).WithCache(app.Cache).WithLogger(app.Logger).WithConfigProvider(generationProvider)
kolGenerationSvc := tenantapp.NewKolGenerationService(
app.DB,
app.KolSubscriptions,
app.KolPrompts,
repository.NewKolUsageRepository(app.DB),
repository.NewArticleRepository(app.DB),
repository.NewAuditRepository(app.DB),
repository.NewQuotaRepository(app.DB),
app.KolPromptAsset,
app.RabbitMQ,
).WithCache(app.Cache)
monitoringCallbackService := tenantapp.NewMonitoringCallbackService(
app.DB,
@@ -86,7 +98,7 @@ func main() {
app.Cache,
app.Logger,
app.Config().Scheduler,
).WithConfigProvider(app.ConfigStore)
).WithKolGenerationService(kolGenerationSvc).WithConfigProvider(app.ConfigStore)
monitoringDailyTaskWorker := tenantapp.NewMonitoringDailyTaskWorker(monitoringService, monitoringCallbackService, app.Logger)
monitoringResultRecoveryWorker := internalscheduler.NewMonitoringResultRecoveryWorker(app.MonitoringDB, monitoringCallbackService, app.Logger)
monitoringLeaseRecoveryWorker := internalscheduler.NewMonitoringLeaseRecoveryWorker(app.MonitoringDB, app.Logger)