303
// addTasks adds both ProcessBuffer and Execute tasks as needed. It should be
304
// called when completing processing/executing tasks, to drive backoff/retry.
305
>
func (i *Invoker) addTasks(ctx chasm.MutableContext) {
invoker.go
306
>
// If we have Attempt = 0 starts, generate a ProcessBufferTask immediately. If we
307
>
// have starts that are backing off, add a timer task for the earliest backoff time.
308
>
if i.hasUnprocessedStarts() {
309
i.getOrCreateEventLog(ctx).LogEvent(ctx, "scheduled processBufferTask immediately")
310
ctx.AddTask(i, chasm.TaskAttributes{
311
ScheduledTime: chasm.TaskScheduledTimeImmediate,
312
}, &schedulerpb.InvokerProcessBufferTask{})
313
>
} else if deadline := i.nextBackoffDeadline(); !deadline.IsZero() {
invoker.go
314
i.getOrCreateEventLog(ctx).LogEvent(ctx,
315
fmt.Sprintf("scheduled processBufferTask for %s", deadline.Format(time.RFC3339)))