From bde991a1f39136739448ca91a9e577275ccf05e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20L=C3=A4ll?= Date: Thu, 22 Sep 2022 14:54:32 +0300 Subject: [PATCH] Revert to loop with threadDelay --- marconi/test/Integration.hs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/marconi/test/Integration.hs b/marconi/test/Integration.hs index 84cf84dff6..9b39949269 100644 --- a/marconi/test/Integration.hs +++ b/marconi/test/Integration.hs @@ -303,20 +303,17 @@ testIndex = H.integration . HE.runFinallies . HE.workspace "chairman" $ \tempAbs tx2 === indexedTx2 -- The query poll - -- queriedTx2 :: C.Tx C.AlonzoEra <- do - -- let - -- queryLoop n = do - -- H.threadDelay 250_000 -- wait 250ms before querying - -- liftIO $ putStrLn $ "query poll #" <> show (n :: Int) - -- txCbors <- liftIO $ ScriptTx.query indexer (ScriptTx.ScriptAddress plutusScriptHash) [] - -- case txCbors of - -- result : _ -> pure result - -- _ -> queryLoop (n + 1) - -- ScriptTx.TxCbor txCbor <- queryLoop 0 - -- H.leftFail $ C.deserialiseFromCBOR (C.AsTx C.AsAlonzoEra) txCbor - txCbors <- liftIO $ ScriptTx.query indexer (ScriptTx.ScriptAddress plutusScriptHash) [] - ScriptTx.TxCbor txCbor <- headM txCbors - queriedTx2 <- H.leftFail $ C.deserialiseFromCBOR (C.AsTx C.AsAlonzoEra) txCbor + queriedTx2 :: C.Tx C.AlonzoEra <- do + let + queryLoop n = do + H.threadDelay 250_000 -- wait 250ms before querying + liftIO $ putStrLn $ "query poll #" <> show (n :: Int) + txCbors <- liftIO $ ScriptTx.query indexer (ScriptTx.ScriptAddress plutusScriptHash) [] + case txCbors of + result : _ -> pure result + _ -> queryLoop (n + 1) + ScriptTx.TxCbor txCbor <- queryLoop 0 + H.leftFail $ C.deserialiseFromCBOR (C.AsTx C.AsAlonzoEra) txCbor tx2 === queriedTx2