mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
16 lines
360 B
Go
16 lines
360 B
Go
package utils
|
|
|
|
import (
|
|
"github.com/apex/log"
|
|
"github.com/cenkalti/backoff/v4"
|
|
"github.com/crawlab-team/crawlab/trace"
|
|
"time"
|
|
)
|
|
|
|
func BackoffErrorNotify(prefix string) backoff.Notify {
|
|
return func(err error, duration time.Duration) {
|
|
log.Errorf("%s error: %v. reattempt in %.1f seconds...", prefix, err, duration.Seconds())
|
|
trace.PrintError(err)
|
|
}
|
|
}
|