304
}
305
307
>
processedTimers := 0
308
>
309
>
// StateMachineTimers are sorted by Deadline, iterate through them as long as the deadline is expired.
310
>
for len(timers) > 0 {
311
>
group := timers[0]
312
>
if !queues.IsTimeExpired(task, t.Now(), ms.ToRealTime(group.Deadline.AsTime())) {
313
break
314
}
315
317
>
err := t.executeSingleStateMachineTimer(ctx, workflowContext, ms, group.Deadline.AsTime(), timer, execute)
318
>
if err != nil {
319
>
// This includes errors such as ErrStaleReference and ErrWorkflowCompleted.
320
>
if !errors.As(err, new(*serviceerror.NotFound)) {
321
metrics.StateMachineTimerProcessingFailuresCounter.With(t.metricsHandler).Record(
322
1,