From 420447009bac7e6e491d6f5d40c2deb3550d11fa Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 23 Apr 2021 15:19:03 +0200 Subject: [PATCH] tweak backoff tolerance --- ocis/pkg/runtime/service/service.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 464df996c..268d7473f 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -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.