Skip to content

Commit 609eec4

Browse files
committed
Fix race
1 parent 0f8f1e8 commit 609eec4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/server/debug.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ func (s *Server) StartCPUProfile(_ context.Context, _ *proto.StartCPUProfileRequ
237237
}
238238

239239
s.cpuProfileBuf = &bytes.Buffer{}
240+
s.cpuProfiling = true
240241
if err := pprof.StartCPUProfile(s.cpuProfileBuf); err != nil {
241242
s.cpuProfileBuf = nil
243+
s.cpuProfiling = false
242244
return nil, fmt.Errorf("start CPU profile: %w", err)
243245
}
244246

245-
s.cpuProfiling = true
246-
247247
log.Info("CPU profiling started")
248248
return &proto.StartCPUProfileResponse{}, nil
249249
}

0 commit comments

Comments
 (0)