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

Commit9219044

Browse files
authored
fix(coderd/metricscache): avoid logging error for no rows (#12988)
Fixes#12938
1 parent6b4eb03 commit9219044

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎coderd/metricscache/metricscache.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func (c *Cache) refreshDeploymentStats(ctx context.Context) error {
162162
}
163163

164164
func (c*Cache)run(ctx context.Context,namestring,interval time.Duration,refreshfunc(context.Context)error) {
165+
logger:=c.log.With(slog.F("name",name),slog.F("interval",interval))
165166
ticker:=time.NewTicker(interval)
166167
deferticker.Stop()
167168

@@ -173,15 +174,13 @@ func (c *Cache) run(ctx context.Context, name string, interval time.Duration, re
173174
ifctx.Err()!=nil {
174175
return
175176
}
176-
c.log.Error(ctx,"refresh",slog.Error(err))
177+
ifxerrors.Is(err,sql.ErrNoRows) {
178+
break
179+
}
180+
logger.Error(ctx,"refresh metrics failed",slog.Error(err))
177181
continue
178182
}
179-
c.log.Debug(
180-
ctx,
181-
name+" metrics refreshed",
182-
slog.F("took",time.Since(start)),
183-
slog.F("interval",interval),
184-
)
183+
logger.Debug(ctx,"metrics refreshed",slog.F("took",time.Since(start)))
185184
break
186185
}
187186

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp