From c9a8ab13c2f1b187bef07049e6448f5873b1ac6c Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 28 Mar 2023 12:50:01 +0200 Subject: [PATCH] fix: set is connected for chain without fallback --- rpc/chain/client.go | 8 +++++++- services/wallet/thirdparty/opensea/client.go | 13 ------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/rpc/chain/client.go b/rpc/chain/client.go index c782b19a4..27e25d912 100644 --- a/rpc/chain/client.go +++ b/rpc/chain/client.go @@ -133,7 +133,7 @@ func (c *ClientWithFallback) setIsConnected(value bool) { c.LastCheckedAt = time.Now().Unix() if !value { c.consecutiveFailureCount += 1 - if c.consecutiveFailureCount > 3 && c.IsConnected { + if c.consecutiveFailureCount > 1 && c.IsConnected { if c.WalletNotifier != nil { c.WalletNotifier(c.ChainID, "down") } @@ -169,15 +169,19 @@ func (c *ClientWithFallback) makeCallNoReturn(main func() error, fallback func() return nil }, func(err error) error { if c.fallback == nil { + c.setIsConnected(false) return err } err = fallback() if err != nil { +<<<<<<< HEAD if isVMError(err) { resultChan <- CommandResult{vmError: err} return nil } +======= +>>>>>>> fdaa1ce1b (fix: set is connected for chain without fallback) c.setIsConnected(false) return err } @@ -214,6 +218,7 @@ func (c *ClientWithFallback) makeCallSingleReturn(main func() (any, error), fall return nil }, func(err error) error { if c.fallback == nil { + c.setIsConnected(false) return err } @@ -263,6 +268,7 @@ func (c *ClientWithFallback) makeCallDoubleReturn(main func() (any, any, error), return nil }, func(err error) error { if c.fallback == nil { + c.setIsConnected(false) return err } diff --git a/services/wallet/thirdparty/opensea/client.go b/services/wallet/thirdparty/opensea/client.go index 24095f282..9ec7c99eb 100644 --- a/services/wallet/thirdparty/opensea/client.go +++ b/services/wallet/thirdparty/opensea/client.go @@ -27,22 +27,9 @@ const ( const AssetLimit = 200 const CollectionLimit = 300 -<<<<<<< HEAD const RequestTimeout = 5 * time.Second const GetRequestRetryMaxCount = 15 const GetRequestWaitTime = 300 * time.Millisecond -======= -const RequestRetryMaxCount = 1 -const RequestWaitTime = 300 * time.Millisecond - -var OpenseaClientInstances = make(map[uint64]*Client) - -var BaseURLs = map[uint64]string{ - 1: "https://api.opensea.io/api/v1", - 4: "https://rinkeby-api.opensea.io/api/v1", - 5: "https://testnets-api.opensea.io/api/v1", -} ->>>>>>> 6173eabe7 (feat: add error on get wallet token) const ChainIDRequiringAPIKey = 1