155
idleExpiration, isIdle := scheduler.getIdleExpiration(ctx, idleTimeTotal, result.NextWakeupTime)
156
if isIdle {
157
>
// Schedule is complete, no need for another buffer task. We keep the schedule's
generator_tasks.go
158
>
// backing mutable state explicitly open for the idle period, during which the
159
>
// customer can describe/modify/restart the schedule.
160
>
//
161
>
// Once the idle timer expires, we close the component.
162
>
generator.getOrCreateEventLog(ctx).LogEvent(ctx,
163
>
fmt.Sprintf("scheduled idle task for %s", idleExpiration.Format(time.RFC3339)))
164
>
ctx.AddTask(scheduler, chasm.TaskAttributes{
165
>
ScheduledTime: idleExpiration,
166
>
}, &schedulerpb.SchedulerIdleTask{
167
>
IdleTimeTotal: durationpb.New(idleTimeTotal),
168
>
})
169
>
// Record the idle-close deadline so it can be surfaced as the
170
>
// ScheduleIdleCloseTime search attribute for stuck-schedule detection.
171
>
scheduler.IdleCloseTime = timestamppb.New(idleExpiration)
172
>
173
>
return nil
174
>
}
175
176
// Not idle: the schedule has work again (or is being held open), so it's