Add logging for ActionServe
This commit is contained in:
parent
b70d057cb8
commit
ae21fd8a11
@ -235,12 +235,17 @@ func ActionServe(c *cli.Context) error {
|
|||||||
|
|
||||||
ticker := time.NewTicker(timeout / 2)
|
ticker := time.NewTicker(timeout / 2)
|
||||||
for {
|
for {
|
||||||
|
// TODO: Consider using ctx with deadline to avoid healthcheck taking more time than ticker,
|
||||||
|
// which will result in being killed by watchdog.
|
||||||
healthy := s.IsHealthy()
|
healthy := s.IsHealthy()
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
if healthy == nil {
|
if healthy == nil {
|
||||||
daemon.SdNotify(false, daemon.SdNotifyWatchdog)
|
daemon.SdNotify(false, daemon.SdNotifyWatchdog)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
// TODO: If unhealthy, should we retry healthcheck immediately, otherwise service will most likely get killed by watchdog.
|
||||||
|
loggers.rootLogger.Errorw("Store reported not healthy, might get killed by watchdog.", "err", healthy)
|
||||||
case <-notifyCtx.Done():
|
case <-notifyCtx.Done():
|
||||||
loggers.rootLogger.Debugw("Notify context cancelled.")
|
loggers.rootLogger.Debugw("Notify context cancelled.")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user