refactor: http retry for retryable errors (#20)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -26,7 +27,6 @@ type Client struct {
|
||||
|
||||
apiURL string
|
||||
apiHeaders map[string]string
|
||||
apiTimeout time.Duration
|
||||
|
||||
cache *cache.Client
|
||||
cacheTempDuration time.Duration
|
||||
@@ -35,6 +35,7 @@ type Client struct {
|
||||
queue chan *media.FeedItem
|
||||
|
||||
m *media.Client
|
||||
http *http.Client
|
||||
log zerolog.Logger
|
||||
ignoresExpr []*nabarr.ExprProgram
|
||||
}
|
||||
@@ -81,10 +82,10 @@ func New(c nabarr.PvrConfig, mode string, m *media.Client, cc *cache.Client) (*C
|
||||
|
||||
apiURL: apiURL,
|
||||
apiHeaders: apiHeaders,
|
||||
apiTimeout: 60 * time.Second,
|
||||
|
||||
m: m,
|
||||
log: l,
|
||||
m: m,
|
||||
http: util.NewRetryableHttpClient(60*time.Second, nil, &l),
|
||||
log: l,
|
||||
}
|
||||
|
||||
// compile expressions
|
||||
|
||||
Reference in New Issue
Block a user