Add missing retry mechanism.

I have no idea how this was missed, but ho hum.
This commit is contained in:
2023-04-08 01:59:28 +01:00
parent b9cd614ae4
commit d843238d46
+8
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/avast/retry-go/v4"
)
@@ -50,6 +51,13 @@ func (c *BaseClient) executeQuery(query []byte, headers any) (result any, err er
return nil
},
retry.OnRetry(func(n uint, err error) {
c.Logger.Error(c, "Retrying query", "error", err.Error())
}),
retry.Attempts(uint(c.retries.max)),
retry.DelayType(retry.BackOffDelay),
retry.Delay(time.Duration(c.retries.delay)*time.Second),
retry.LastErrorOnly(true),
)
if len(queryResult.Errors) > 0 {