Skip to content

Commit f1f05cc

Browse files
committed
Pass agent ctx into activityBumpWorkspace
1 parent ca68db2 commit f1f05cc

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

coderd/activitybump.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,15 @@ import (
1010
"golang.org/x/xerrors"
1111

1212
"cdr.dev/slog"
13-
"github.com/coder/coder/coderd/authzquery"
1413
"github.com/coder/coder/coderd/database"
15-
"github.com/coder/coder/coderd/rbac"
1614
)
1715

1816
// activityBumpWorkspace automatically bumps the workspace's auto-off timer
1917
// if it is set to expire soon.
20-
func activityBumpWorkspace(log slog.Logger, db database.Store, workspaceID uuid.UUID) {
18+
func activityBumpWorkspace(ctx context.Context, log slog.Logger, db database.Store, workspaceID uuid.UUID) {
2119
// We set a short timeout so if the app is under load, these
2220
// low priority operations fail first.
23-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
24-
// We always want to use the **system** authz context for this.
25-
ctx = authzquery.WithAuthorizeSystemContext(ctx, rbac.RolesAdminSystem())
21+
ctx, cancel := context.WithTimeout(ctx, time.Second*15)
2622
defer cancel()
2723

2824
err := db.InTx(func(s database.Store) error {

coderd/workspaceagents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
897897
slog.F("payload", req),
898898
)
899899

900-
activityBumpWorkspace(api.Logger.Named("activity_bump"), api.Database, workspace.ID)
900+
activityBumpWorkspace(ctx, api.Logger.Named("activity_bump"), api.Database, workspace.ID)
901901

902902
payload, err := json.Marshal(req)
903903
if err != nil {

0 commit comments

Comments
 (0)