mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat!: bump workspace activity by 1 hour (#10704)
Marked as a breaking change as the previous activity bump was always the TTL duration of the workspace/template. This change is more cost conservative, only bumping by 1 hour for workspace activity. To accommodate wrap around, eg bumping a workspace into the next autostart, the deadline is bumped by the TTL if the workspace crosses the autostart threshold. This is a niche case that is likely caused by an idle terminal making a workspace survive through a night. The next morning, the workspace will get activity bumped the default TTL on the autostart, being similar to as if the workspace was autostarted again. In practice, a good way to avoid this is to set a max_deadline of <24hrs to avoid wrap around entirely.
This commit is contained in:
@ -24,14 +24,16 @@ type sqlcQuerier interface {
|
||||
// multiple provisioners from acquiring the same jobs. See:
|
||||
// https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FOR-UPDATE-SHARE
|
||||
AcquireProvisionerJob(ctx context.Context, arg AcquireProvisionerJobParams) (ProvisionerJob, error)
|
||||
// We bump by the original TTL to prevent counter-intuitive behavior
|
||||
// as the TTL wraps. For example, if I set the TTL to 12 hours, sign off
|
||||
// work at midnight, come back at 10am, I would want another full day
|
||||
// of uptime.
|
||||
// Bumps the workspace deadline by 1 hour. If the workspace bump will
|
||||
// cross an autostart threshold, then the bump is autostart + TTL. This
|
||||
// is the deadline behavior if the workspace was to autostart from a stopped
|
||||
// state.
|
||||
// Max deadline is respected, and will never be bumped.
|
||||
// The deadline will never decrease.
|
||||
// We only bump if the raw interval is positive and non-zero.
|
||||
// We only bump if workspace shutdown is manual.
|
||||
// We only bump when 5% of the deadline has elapsed.
|
||||
ActivityBumpWorkspace(ctx context.Context, workspaceID uuid.UUID) error
|
||||
ActivityBumpWorkspace(ctx context.Context, arg ActivityBumpWorkspaceParams) error
|
||||
// AllUserIDs returns all UserIDs regardless of user status or deletion.
|
||||
AllUserIDs(ctx context.Context) ([]uuid.UUID, error)
|
||||
// Archiving templates is a soft delete action, so is reversible.
|
||||
|
Reference in New Issue
Block a user