Skip to content

Commit 295b755

Browse files
committed
add comment to explain grace period
1 parent 9625637 commit 295b755

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

enterprise/coderd/schedule/template.go

+3
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ func (s *EnterpriseTemplateScheduleStore) updateWorkspaceBuild(ctx context.Conte
277277
}
278278

279279
// If max deadline is before now()+2h, then set it to that.
280+
// This is intended to give ample warning to this workspace about an upcoming auto-stop.
281+
// If we were to omit this "grace" period, then this workspace could be set to be stopped "now".
282+
// The "2 hours" was an arbitrary decision for this window.
280283
now := s.now()
281284
if !autostop.MaxDeadline.IsZero() && autostop.MaxDeadline.Before(now.Add(2*time.Hour)) {
282285
autostop.MaxDeadline = now.Add(time.Hour * 2)

0 commit comments

Comments
 (0)