package maintenance import ( "git.coopcloud.tech/wiki-cafe/member-console/internal/workflows/common" "go.temporal.io/sdk/workflow" ) // EnsureWebhookPartitionsWorkflow keeps core.webhook_events' monthly RANGE // partitions provisioned ahead of need. It runs on a recurring schedule as // the backstop to the console's own boot pass: the boot pass covers every // deployment on every restart, Temporal-configured or not, but a deployment // that runs for longer than the partition lookahead window without // restarting needs this schedule to keep extending it (design.md D3, // webhook-partition-maintenance spec, "Long-running deployment never // exhausts partitions"). func EnsureWebhookPartitionsWorkflow(ctx workflow.Context) error { logger := workflow.GetLogger(ctx) ctx = workflow.WithActivityOptions(ctx, common.DefaultActivityOptions()) var activities *Activities var out EnsureWebhookPartitionsOutput if err := workflow.ExecuteActivity(ctx, activities.EnsureWebhookPartitionsActivity).Get(ctx, &out); err != nil { logger.Error("EnsureWebhookPartitionsActivity failed", "error", err) return err } logger.Info("EnsureWebhookPartitionsWorkflow completed", "monthsAhead", out.MonthsAhead) return nil }