@@ -1648,7 +1648,6 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1648
1648
)
1649
1649
1650
1650
for _ , proc := range procs {
1651
-
1652
1651
containsFn := func (e string ) bool {
1653
1652
contains := strings .Contains (proc .Cmd (), e )
1654
1653
return contains
@@ -2099,9 +2098,9 @@ func isCustomOOMScore(agentScore int, process *agentproc.Process) bool {
2099
2098
return agentScore != score && score != 1000 && score != 0 && score != 998
2100
2099
}
2101
2100
2102
- // logDebouncer prevents generating a log for a particular message if
2101
+ // logDebouncer skips writing a log for a particular message if
2103
2102
// it's been emitted within the given interval duration.
2104
- // It's a shoddy implementation use in one spot that should be replaced at
2103
+ // It's a shoddy implementation used in one spot that should be replaced at
2105
2104
// some point.
2106
2105
type logDebouncer struct {
2107
2106
logger slog.Logger
@@ -2120,8 +2119,7 @@ func (l *logDebouncer) Error(ctx context.Context, msg string, fields ...any) {
2120
2119
func (l * logDebouncer ) log (ctx context.Context , level slog.Level , msg string , fields ... any ) {
2121
2120
// This (bad) implementation assumes you wouldn't reuse the same msg
2122
2121
// for different levels.
2123
- last , ok := l .messages [msg ]
2124
- if ok && time .Since (last ) < l .interval {
2122
+ if last , ok := l .messages [msg ]; ok && time .Since (last ) < l .interval {
2125
2123
return
2126
2124
}
2127
2125
switch level {
0 commit comments