Skip to content

Commit

Permalink
Rename mutex in pprof service
Browse files Browse the repository at this point in the history
  • Loading branch information
niklr authored and Leo Chen committed Jul 23, 2021
1 parent cb27338 commit 7cf9c37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/service/pprof/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (
initOnce sync.Once
svc = &Service{}
cpuFile *os.File
lock sync.Mutex
cpuLock sync.Mutex
)

// NewService creates the new pprof service
Expand Down Expand Up @@ -178,8 +178,8 @@ func saveProfile(profile Profile, dir string) error {

// restartCpuProfile stops the current CPU profile, if any and then starts a new CPU profile. While profiling in the background, the profile will be buffered and written to a file.
func restartCpuProfile(dir string) error {
lock.Lock()
defer lock.Unlock()
cpuLock.Lock()
defer cpuLock.Unlock()
stopCpuProfile()
f, err := newTempFile(dir, CPU, ".pb.gz")
if err != nil {
Expand Down

0 comments on commit 7cf9c37

Please sign in to comment.