Closed srghma closed 2 years ago
https://asciinema.org/a/466716
yes, test doesn't fail anymore if I add delay
~/projects/purescript-web3 ➦ 222a2aa ±✚ git diff | cat
diff --git a/src/Network/Ethereum/Web3/JsonRPC.purs b/src/Network/Ethereum/Web3/JsonRPC.purs
index a69b36f..3d9ca02 100644
--- a/src/Network/Ethereum/Web3/JsonRPC.purs
+++ b/src/Network/Ethereum/Web3/JsonRPC.purs
@@ -1,14 +1,15 @@
module Network.Ethereum.Web3.JsonRPC where
import Prelude
-import Effect.Aff (Aff, Error, attempt, error)
-import Effect.Aff.Class (liftAff)
-import Effect.Aff.Compat (fromEffectFnAff, EffectFnAff)
+
import Control.Monad.Error.Class (throwError)
import Control.Monad.Except (runExcept)
import Control.Monad.Reader (ask)
import Data.Array ((:))
import Data.Either (Either(..))
+import Effect.Aff (Aff, Error, Milliseconds(..), attempt, delay, error)
+import Effect.Aff.Class (liftAff)
+import Effect.Aff.Compat (fromEffectFnAff, EffectFnAff)
import Foreign (Foreign)
import Foreign.Class (class Decode, class Encode, decode, encode)
import Foreign.Generic (defaultOptions, genericEncodeJSON)
@@ -25,7 +26,9 @@ class Remote a where
instance remoteBase :: (Decode a) => Remote (Web3 a) where
remote_ f = do
p <- ask
- res' <- liftAff $ attempt $ f p mempty
+ res' <- liftAff $ attempt do
+ delay (Milliseconds 300.0)
+ f p mempty
case res' of
Left uncheckedErr -> throwError $ asError $ RemoteError $ show uncheckedErr
Right res -> case runExcept $ decode res of
prob we know how to solve - filters should use delay
https://github.com/ethjs/ethjs-provider-http/blob/03f911db08757bd5edeb5b613255a25df0124d84/src/index.js#L16
https://pastebin.com/QvhJBTVN
https://asciinema.org/a/466689
this error is reproducible on "Case [Past, ∞] With Trail" test (I can disable all other tests with
itOnly
method and it will fail)maybe my computer is too fast -> too many
eth_blockNumber
,eth_getLogs
-> geth just failsTODO:
eth_blockNumber, eth_getLogs