tweak backoff tolerance

This commit is contained in:
A.Unger
2021-04-23 15:19:03 +02:00
parent 8da06d32b9
commit 420447009b

View File

@@ -132,14 +132,23 @@ func Start(o ...Option) error {
setMicroLogger()
// tolerance controls backoff cycles from the supervisor.
tolerance := 5
totalBackoff := 0
// Start creates its own supervisor. Running services under `ocis server` will create its own supervision tree.
s.Supervisor = suture.New("ocis", suture.Spec{
EventHook: func(e suture.Event) {
if e.Type() == suture.EventTypeServiceTerminate {
halt <- os.Interrupt
if e.Type() == suture.EventTypeBackoff {
totalBackoff++
if totalBackoff == tolerance {
halt <- os.Interrupt
}
}
s.Log.Info().Str("event", e.String()).Msg(fmt.Sprintf("supervisor: %v", e.Map()["supervisor_name"]))
},
FailureThreshold: 5,
FailureBackoff: 3 * time.Second,
})
// reva storages have their own logging. For consistency sake the top level logging will cascade to reva.