chore: cover deadline crossing autostart border on start (#13115)

When starting a workspace, if the deadline crosses an autostart boundary, the deadline is set to autostart + TTL. 
This copies the behavior in `ActivityBumpWorkspace`, but does not require activity.
This commit is contained in:
Steven Masley
2024-05-01 10:43:04 -05:00
committed by GitHub
parent 71a03a8b1d
commit 845407fe7a
8 changed files with 211 additions and 39 deletions

View File

@ -263,8 +263,9 @@ func (s *EnterpriseTemplateScheduleStore) updateWorkspaceBuild(ctx context.Conte
TemplateScheduleStore: s,
UserQuietHoursScheduleStore: *s.UserQuietHoursScheduleStore.Load(),
// Use the job completion time as the time we calculate autostop from.
Now: job.CompletedAt.Time,
Workspace: workspace,
Now: job.CompletedAt.Time,
Workspace: workspace,
WorkspaceAutostart: workspace.AutostartSchedule.String,
})
if err != nil {
return xerrors.Errorf("calculate new autostop for workspace %q: %w", workspace.ID, err)