fix(coderd): make activitybump aware of default template ttl (#10253)

The refactored ActivityBump query did not take into account the
template-level TTL, resulting in potentially incorrect bump
amounts for workspaces that have both a user-defined and template-
defined TTL that differ.

This change is ported over from PR#10035 to reduce the overall
size of that PR.

Also includes a drive-by unit test in autobuild for checking template autostop/TTL.

Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
Cian Johnston
2023-10-13 13:53:02 +01:00
committed by GitHub
parent 2a4ac2a53c
commit d56f49f619
6 changed files with 120 additions and 15 deletions

View File

@ -28,6 +28,7 @@ type sqlcQuerier interface {
// 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.
// 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