feat: add template activity_bump property (#11734)

Allows template admins to configure the activity bump duration. Defaults to 1h.
This commit is contained in:
Dean Sheather
2024-02-12 23:00:35 -08:00
committed by GitHub
parent fead57f304
commit e1e352d8c1
34 changed files with 354 additions and 90 deletions

View File

@ -24,12 +24,14 @@ 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)
// 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.
// Bumps the workspace deadline by the template's configured "activity_bump"
// duration (default 1h). 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 the deadline will never be bumped past it.
// The deadline will never decrease.
// We only bump if the template has an activity bump duration set.
// 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.