198
// expected to not be able to fire (BUFFER_ONE / BUFFER_ALL waiting on a prior
199
// running workflow). What remains is counted as an anomaly.
200
>
func (a *Activities) runOverdueScan(ctx context.Context, query string) error {
invariants.go
201
>
const subScanner = "overdue_next_action_time"
202
>
metricName := metrics.ScheduleInvariantsScannerOverdueNextActionTimeCount.Name()
203
>
204
>
// maxChecks bounds the number of per-schedule DescribeSchedule calls per namespace
205
>
// per scan pass, so a namespace with a large backlog of overdue schedules can't
206
>
// hammer the frontend. Schedules beyond the cap are left unchecked for this pass.
207
>
maxChecks := a.opts().OverdueNextActionTimeMaxChecksPerNamespace
208
>
for _, nsName := range a.ListAllNamespaces() {
209
>
var nsAnomalies, checked int64
210
>
var scanErr error
211
>
for scheduleID, err := range a.schedulesInNamespace(ctx, nsName, query) {
212
>
if err != nil {
213
scanErr = err
214
break
215
}
217
a.logger.Warn("overdue scan hit per-namespace check cap; remaining schedules left unchecked this pass",
218
tag.WorkflowNamespace(nsName),