Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4c29f3

Browse files
authored
fix: Always use UTC time when inserting stats (#4009)
Fixes a flake reported by@mafredri
1 parentd0b02e5 commitb4c29f3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎coderd/templates_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,6 @@ func TestTemplateDAUs(t *testing.T) {
665665
workspaces,err=client.Workspaces(ctx, codersdk.WorkspaceFilter{})
666666
require.NoError(t,err)
667667
assert.WithinDuration(t,
668-
time.Now(),workspaces[0].LastUsedAt,time.Minute,
668+
database.Now(),workspaces[0].LastUsedAt,time.Minute,
669669
)
670670
}

‎coderd/workspaceagents.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
848848

849849
_,err=api.Database.InsertAgentStat(ctx, database.InsertAgentStatParams{
850850
ID:uuid.New(),
851-
CreatedAt:time.Now(),
851+
CreatedAt:database.Now(),
852852
AgentID:workspaceAgent.ID,
853853
WorkspaceID:build.WorkspaceID,
854854
UserID:workspace.OwnerID,
@@ -865,7 +865,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
865865

866866
err=api.Database.UpdateWorkspaceLastUsedAt(ctx, database.UpdateWorkspaceLastUsedAtParams{
867867
ID:build.WorkspaceID,
868-
LastUsedAt:time.Now(),
868+
LastUsedAt:database.Now(),
869869
})
870870
iferr!=nil {
871871
httpapi.Write(rw,http.StatusBadRequest, codersdk.Response{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp