feat(schedule): support KOL subscription targets and random time windows
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user