Increase num of retries, add more errors to retry for
This commit is contained in:
parent
71a9087e4d
commit
b33ee78eff
@ -2,6 +2,7 @@ package graph
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -173,7 +174,9 @@ func KiotaHTTPClient(
|
|||||||
const (
|
const (
|
||||||
defaultDelay = 3 * time.Second
|
defaultDelay = 3 * time.Second
|
||||||
defaultHTTPClientTimeout = 1 * time.Hour
|
defaultHTTPClientTimeout = 1 * time.Hour
|
||||||
defaultMaxRetries = 3
|
// Bumping retries to 6 since we have noticed that auth token expiry errors
|
||||||
|
// may continue to persist even after 3 retries.
|
||||||
|
defaultMaxRetries = 6
|
||||||
// FIXME: This should ideally be 0, but if we set to 0, graph
|
// FIXME: This should ideally be 0, but if we set to 0, graph
|
||||||
// client with automatically set the context timeout to 0 as
|
// client with automatically set the context timeout to 0 as
|
||||||
// well which will make the client unusable.
|
// well which will make the client unusable.
|
||||||
@ -376,6 +379,7 @@ func wrapAdapter(gra *msgraphsdkgo.GraphRequestAdapter, cc *clientConfig) *adapt
|
|||||||
var connectionEnded = filters.Contains([]string{
|
var connectionEnded = filters.Contains([]string{
|
||||||
"connection reset by peer",
|
"connection reset by peer",
|
||||||
"client connection force closed",
|
"client connection force closed",
|
||||||
|
"read: connection timed out",
|
||||||
})
|
})
|
||||||
|
|
||||||
func (aw *adapterWrap) Send(
|
func (aw *adapterWrap) Send(
|
||||||
@ -416,7 +420,9 @@ func (aw *adapterWrap) Send(
|
|||||||
err = stackWithCoreErr(ictx, err, 1)
|
err = stackWithCoreErr(ictx, err, 1)
|
||||||
e = err
|
e = err
|
||||||
|
|
||||||
if IsErrConnectionReset(err) || connectionEnded.Compare(err.Error()) {
|
if IsErrConnectionReset(err) ||
|
||||||
|
connectionEnded.Compare(err.Error()) ||
|
||||||
|
errors.Is(err, io.ErrUnexpectedEOF) {
|
||||||
logger.Ctx(ictx).Debug("http connection error")
|
logger.Ctx(ictx).Debug("http connection error")
|
||||||
events.Inc(events.APICall, "connectionerror")
|
events.Inc(events.APICall, "connectionerror")
|
||||||
} else if errors.Is(err, core.ErrAuthTokenExpired) {
|
} else if errors.Is(err, core.ErrAuthTokenExpired) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user