mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor(coderd/database): split Time and Now into dbtime package (#9482)
Ref: #9380
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"cdr.dev/slog"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
)
|
||||
|
||||
// activityBumpWorkspace automatically bumps the workspace's auto-off timer
|
||||
@@ -69,14 +70,14 @@ func activityBumpWorkspace(ctx context.Context, log slog.Logger, db database.Sto
|
||||
return nil
|
||||
}
|
||||
|
||||
newDeadline := database.Now().Add(bumpAmount)
|
||||
newDeadline := dbtime.Now().Add(bumpAmount)
|
||||
if !build.MaxDeadline.IsZero() && newDeadline.After(build.MaxDeadline) {
|
||||
newDeadline = build.MaxDeadline
|
||||
}
|
||||
|
||||
if err := s.UpdateWorkspaceBuildByID(ctx, database.UpdateWorkspaceBuildByIDParams{
|
||||
ID: build.ID,
|
||||
UpdatedAt: database.Now(),
|
||||
UpdatedAt: dbtime.Now(),
|
||||
ProvisionerState: build.ProvisionerState,
|
||||
Deadline: newDeadline,
|
||||
MaxDeadline: build.MaxDeadline,
|
||||
|
||||
Reference in New Issue
Block a user