483
invoker *Invoker,
484
scheduler *Scheduler,
486
>
runningWorkflows := invoker.runningWorkflowExecutions()
487
>
isRunning := len(runningWorkflows) > 0
488
>
result.missedCatchupByActionRunning = make(map[bool]int64)
489
>
490
>
// Processing completely ignores any BufferedStart that's already executing/backing off.
491
>
pendingBufferedStarts := util.FilterSlice(invoker.GetBufferedStarts(), func(start *schedulespb.BufferedStart) bool {
492
return start.Attempt == 0
493
})
494
495
// Resolve overlap policies and trim BufferedStarts that are skipped by policy.
496
>
action := legacyscheduler.ProcessBuffer(pendingBufferedStarts, isRunning, scheduler.resolveOverlapPolicy)
invoker_tasks.go
497
>
498
>
// ProcessBuffer will drop starts by omitting them from NewBuffer. Start with the
499
>
// diff between the input and NewBuffer, and add any executing starts.
500
>
keepStarts := make(map[string]struct{}) // request ID -> is present
501
>
for _, start := range action.NewBuffer {
502
keepStarts[start.GetRequestId()] = struct{}{}
503
}
504
505
// Combine all available starts.
507
>
if action.NonOverlappingStart != nil {
508
readyStarts = append(readyStarts, action.NonOverlappingStart)
509
}
510
511
// Update result metrics.
513
>
result.overlapSkippedByPolicy = action.OverlapSkippedByPolicy
514
>
515
>
// Add starting workflows to result, trim others. Catchup-window expiry is
516
>
// checked before useScheduledAction so that a start past its catchup
517
>
// window doesn't consume a LimitedActions slot.
518
>
droppedCounter := newTaggedMetricsHandler(h.metricsHandler, scheduler).
519
>
Counter(metrics.ScheduleBufferedStartDropped.Name())
520
>
for _, start := range readyStarts {
521
deadline := h.startWorkflowDeadline(ctx, scheduler, start)
522
if ctx.Now(invoker).After(deadline) {