Add retry mechanism.

This commit is contained in:
2023-04-07 15:45:43 +01:00
parent e0913f8824
commit 2a628a7da7
6 changed files with 52 additions and 20 deletions
+4
View File
@@ -40,6 +40,10 @@ func NewConnection() *BaseClient {
b.cache.enabled = envutil.GetBool("GRAPHQL_CACHE_ENABLED", true)
b.cache.ttl = envutil.GetInt("GRAPHQL_CACHE_TTL", 60)
b.retries.enabled = envutil.GetBool("GRAPHQL_RETRIES_ENABLED", true)
b.retries.max = envutil.GetInt("GRAPHQL_RETRIES_MAX", 1)
b.retries.delay = envutil.GetInt("GRAPHQL_RETRIES_DELAY", 300)
if b.cache.enabled {
var err error
b.cache.client, err = bigcache.NewBigCache(bigcache.DefaultConfig(time.Duration(b.cache.ttl) * time.Second))