mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add workspace activity linter (#13273)
This commit is contained in:
@@ -41,6 +41,7 @@ func ActivityBumpWorkspace(ctx context.Context, log slog.Logger, db database.Sto
|
||||
// low priority operations fail first.
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second*15)
|
||||
defer cancel()
|
||||
// nolint:gocritic // (#13146) Will be moved soon as part of refactor.
|
||||
err := db.ActivityBumpWorkspace(ctx, database.ActivityBumpWorkspaceParams{
|
||||
NextAutostart: nextAutostart.UTC(),
|
||||
WorkspaceID: workspaceID,
|
||||
|
||||
@@ -102,6 +102,7 @@ func (a *StatsAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateStatsR
|
||||
return nil
|
||||
})
|
||||
errGroup.Go(func() error {
|
||||
// nolint:gocritic // (#13146) Will be moved soon as part of refactor.
|
||||
err := a.Database.UpdateWorkspaceLastUsedAt(ctx, database.UpdateWorkspaceLastUsedAtParams{
|
||||
ID: workspace.ID,
|
||||
LastUsedAt: now,
|
||||
|
||||
@@ -240,6 +240,7 @@ func (b *Batcher) flush(ctx context.Context, forced bool, reason string) {
|
||||
b.buf.ConnectionsByProto = payload
|
||||
}
|
||||
|
||||
// nolint:gocritic // (#13146) Will be moved soon as part of refactor.
|
||||
err = b.store.InsertWorkspaceAgentStats(ctx, *b.buf)
|
||||
elapsed := time.Since(start)
|
||||
if err != nil {
|
||||
|
||||
@@ -1244,6 +1244,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
|
||||
})
|
||||
if req.SessionCount() > 0 {
|
||||
errGroup.Go(func() error {
|
||||
// nolint:gocritic // (#13146) Will be moved soon as part of refactor.
|
||||
err := api.Database.UpdateWorkspaceLastUsedAt(ctx, database.UpdateWorkspaceLastUsedAtParams{
|
||||
ID: workspace.ID,
|
||||
LastUsedAt: now,
|
||||
|
||||
@@ -130,6 +130,7 @@ func (tr *Tracker) flush(now time.Time) {
|
||||
authCtx := dbauthz.AsSystemRestricted(ctx)
|
||||
tr.flushLock.Lock()
|
||||
defer tr.flushLock.Unlock()
|
||||
// nolint:gocritic // (#13146) Will be moved soon as part of refactor.
|
||||
if err := tr.s.BatchUpdateWorkspaceLastUsedAt(authCtx, database.BatchUpdateWorkspaceLastUsedAtParams{
|
||||
LastUsedAt: now,
|
||||
IDs: ids,
|
||||
|
||||
Reference in New Issue
Block a user