package bragi import ( "math" "time" "github.com/sirupsen/logrus" ) type Source interface { // Name returns the name of the source. Name() string // Events returns a channel that will be used to send events to the source. Events() <-chan Event } func backoff(attempt int) { if attempt > 0 { delay := time.Duration(math.Pow(math.E, float64(attempt))) * time.Second logrus.WithField("attempt", attempt).Infof("retrying in %s", delay) time.Sleep(delay) } }