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

@ -11,6 +11,7 @@ import (
"github.com/containous/staert"
"github.com/containous/traefik/job"
"github.com/containous/traefik/log"
"github.com/containous/traefik/safe"
"github.com/docker/libkv/store"
"github.com/satori/go.uuid"
)
@ -109,7 +110,7 @@ func (d *Datastore) watchChanges() error {
notify := func(err error, time time.Duration) {
log.Errorf("Error in watch datastore: %+v, retrying in %s", err, time)
}
err := backoff.RetryNotify(operation, job.NewBackOff(backoff.NewExponentialBackOff()), notify)
err := backoff.RetryNotify(safe.OperationWithRecover(operation), job.NewBackOff(backoff.NewExponentialBackOff()), notify)
if err != nil {
log.Errorf("Error in watch datastore: %v", err)
}