Skip to content

Commit

Permalink
Merge pull request #190 from Cryptophobia/fix-golang-fluentd-race-con…
Browse files Browse the repository at this point in the history
…dition-on-init

fix(config-reloader): add timeout seconds on startup
  • Loading branch information
Cryptophobia committed Mar 31, 2021
2 parents ec3009e + e8984fa commit 5df0d76
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config-reloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ func main() {
logrus.Fatalf("Cannot start control loop %+v", err)
}

// Add this for a timeout between 0-120 seconds (default: 30 (ExecTimeoutSeconds))
// This is for golang/fluentd race condition when KFO starts/restarts:
if cfg.ExecTimeoutSeconds > 0 && cfg.ExecTimeoutSeconds <= 120 {
logrus.Infof("Sleeping for %v seconds in order for fluentd to be ready.", cfg.ExecTimeoutSeconds)
time.Sleep(time.Second * time.Duration(cfg.ExecTimeoutSeconds))
}

if cfg.IntervalSeconds == 0 {
ctrl.RunOnce()
return
Expand Down

0 comments on commit 5df0d76

Please sign in to comment.