Skip to content

Commit 04ee5cb

Browse files
committed
defer first
1 parent d132480 commit 04ee5cb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

agent/agent.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,15 +1282,6 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
12821282
var prioritizedProcs = []string{"coder agent"}
12831283

12841284
func (a *agent) manageProcessPriorityLoop(ctx context.Context) {
1285-
if val := a.envVars[EnvProcPrioMgmt]; val == "" || runtime.GOOS != "linux" {
1286-
a.logger.Debug(ctx, "process priority not enabled, agent will not manage process niceness/oom_score_adj ",
1287-
slog.F("env_var", EnvProcPrioMgmt),
1288-
slog.F("value", val),
1289-
slog.F("goos", runtime.GOOS),
1290-
)
1291-
return
1292-
}
1293-
12941285
defer func() {
12951286
if r := recover(); r != nil {
12961287
a.logger.Critical(ctx, "recovered from panic",
@@ -1300,6 +1291,15 @@ func (a *agent) manageProcessPriorityLoop(ctx context.Context) {
13001291
}
13011292
}()
13021293

1294+
if val := a.envVars[EnvProcPrioMgmt]; val == "" || runtime.GOOS != "linux" {
1295+
a.logger.Debug(ctx, "process priority not enabled, agent will not manage process niceness/oom_score_adj ",
1296+
slog.F("env_var", EnvProcPrioMgmt),
1297+
slog.F("value", val),
1298+
slog.F("goos", runtime.GOOS),
1299+
)
1300+
return
1301+
}
1302+
13031303
if a.processManagementTick == nil {
13041304
ticker := time.NewTicker(time.Second)
13051305
defer ticker.Stop()

0 commit comments

Comments
 (0)