go services: fix bug that starts profiling 3 times
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
ab32b5f954
commit
b943dda1b7
4 changed files with 15 additions and 5 deletions
|
@ -95,6 +95,9 @@ func initProfiling(service, version string) {
|
|||
// ProjectID: "my-project",
|
||||
}); err != nil {
|
||||
log.Printf("warn: failed to start profiler: %+v", err)
|
||||
} else {
|
||||
log.Print("started stackdriver profiler")
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
log.Printf("sleeping %v to retry initializing stackdriver profiler", d)
|
||||
|
|
|
@ -145,6 +145,9 @@ func initProfiling(log logrus.FieldLogger, service, version string) {
|
|||
// ProjectID: "my-project",
|
||||
}); err != nil {
|
||||
log.Warnf("warn: failed to start profiler: %+v", err)
|
||||
} else {
|
||||
log.Info("started stackdriver profiler")
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
log.Debugf("sleeping %v to retry initializing stackdriver profiler", d)
|
||||
|
|
|
@ -90,12 +90,13 @@ func initProfiling(service, version string) {
|
|||
// ProjectID: "my-project",
|
||||
}); err != nil {
|
||||
log.Printf("warn: failed to start profiler: %+v", err)
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
log.Printf("sleeping %v to retry initializing stackdriver profiler", d)
|
||||
time.Sleep(d)
|
||||
continue
|
||||
} else {
|
||||
log.Print("started stackdriver profiler")
|
||||
return
|
||||
}
|
||||
return
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
log.Debugf("sleeping %v to retry initializing stackdriver profiler", d)
|
||||
time.Sleep(d)
|
||||
}
|
||||
log.Printf("warning: could not initialize stackdriver profiler after retrying, giving up")
|
||||
}
|
||||
|
|
|
@ -120,6 +120,9 @@ func initProfiling(service, version string) {
|
|||
// ProjectID: "my-project",
|
||||
}); err != nil {
|
||||
log.Printf("warn: failed to start profiler: %+v", err)
|
||||
} else {
|
||||
log.Print("started stackdriver profiler")
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
log.Printf("sleeping %v to retry initializing stackdriver profiler", d)
|
||||
|
|
Loading…
Reference in a new issue