Skip to content

fix: remove update to workspace TTL on template TTL change for AGPL #15943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions coderd/schedule/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package schedule

import (
"context"
"database/sql"
"time"

"github.com/google/uuid"
Expand Down Expand Up @@ -229,23 +228,6 @@ func (*agplTemplateScheduleStore) Set(ctx context.Context, db database.Store, tp
return xerrors.Errorf("update template schedule: %w", err)
}

// Users running the AGPL version are unable to customize their workspaces
// autostop, so we want to keep their workspaces in track with any template
// TTL changes.
if tpl.DefaultTTL != int64(opts.DefaultTTL) {
var ttl sql.NullInt64
if opts.DefaultTTL != 0 {
ttl = sql.NullInt64{Valid: true, Int64: int64(opts.DefaultTTL)}
}

if err = db.UpdateWorkspacesTTLByTemplateID(ctx, database.UpdateWorkspacesTTLByTemplateIDParams{
TemplateID: tpl.ID,
Ttl: ttl,
}); err != nil {
return xerrors.Errorf("update workspace ttl by template id %q: %w", tpl.ID, err)
}
}

template, err = db.GetTemplateByID(ctx, tpl.ID)
if err != nil {
return xerrors.Errorf("fetch updated template: %w", err)
Expand Down
150 changes: 0 additions & 150 deletions coderd/schedule/template_test.go

This file was deleted.

Loading