mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix: close profile in the mvccPutFunc func
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
parent
84e67ffaf6
commit
90152fe419
@ -77,7 +77,7 @@ func mvccPutFunc(_ *cobra.Command, _ []string) {
|
||||
fmt.Fprintln(os.Stderr, "Failed to create a file for storing cpu profile result: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
defer f.Close()
|
||||
err = pprof.StartCPUProfile(f)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Failed to start cpu profile: ", err)
|
||||
@ -92,7 +92,7 @@ func mvccPutFunc(_ *cobra.Command, _ []string) {
|
||||
fmt.Fprintln(os.Stderr, "Failed to create a file for storing heap profile result: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
defer f.Close()
|
||||
defer func() {
|
||||
err := pprof.WriteHeapProfile(f)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user