Files
beatglow/source.go
T
2026-10-29 17:28:51 +01:00

25 lines
474 B
Go

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)
}
}