Checkpoint
This commit is contained in:
125 files changed
+59376
No files matched your search
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user