1
0
Fork 0

Add Operation with recover

This commit is contained in:
Emile Vauge 2016-12-08 13:32:12 +01:00
parent a394e6a3e3
commit be362f0d9f
No known key found for this signature in database
GPG key ID: D808B4C167352E59
11 changed files with 45 additions and 12 deletions

View file

@ -47,7 +47,7 @@ func (l *Leadership) Participate(pool *safe.Pool) {
notify := func(err error, time time.Duration) {
log.Errorf("Leadership election error %+v, retrying in %s", err, time)
}
err := backoff.RetryNotify(operation, backOff, notify)
err := backoff.RetryNotify(safe.OperationWithRecover(operation), backOff, notify)
if err != nil {
log.Errorf("Cannot elect leadership %+v", err)
}