@@ -27,12 +27,11 @@ module Cardano.DbSync.Sync
27
27
) where
28
28
29
29
import Cardano.Prelude hiding (Meta , Nat , option , (%) )
30
- import Prelude (error )
31
30
32
31
import Control.Tracer (Tracer )
33
32
34
33
import Cardano.BM.Data.Tracer (ToLogObject (.. ), ToObject )
35
- import Cardano.BM.Trace (Trace , appendName , logInfo )
34
+ import Cardano.BM.Trace (Trace , appendName , logInfo , logWarning )
36
35
import qualified Cardano.BM.Trace as Logging
37
36
38
37
import Cardano.Client.Subscription (subscribe )
@@ -444,13 +443,20 @@ chainSyncClientFix backend tracer fixData = Client.ChainSyncClient $ do
444
443
when shouldLog $
445
444
liftIO $ logInfo tracer $ mconcat [" Starting fixing Plutus Data " , textShow point]
446
445
newLastSize <- liftIO $ updateSizeAndLog lastSize (sizeFixData fds)
447
- pure $ Client. SendMsgFindIntersect
448
- [point]
449
- (Client. ClientStIntersect
446
+ let clientStIntersect =
447
+ Client. ClientStIntersect
450
448
{ Client. recvMsgIntersectFound = \ _pnt _tip -> Client. ChainSyncClient $
451
449
pure $ Client. SendMsgRequestNext (clientStNext newLastSize fdOnPoint fdRest) (pure $ clientStNext newLastSize fdOnPoint fdRest)
452
- , Client. recvMsgIntersectNotFound = \ _tip -> error " recvMsgIntersectNotFound"
453
- })
450
+ , Client. recvMsgIntersectNotFound = \ tip -> Client. ChainSyncClient $ do
451
+ liftIO $ logWarning tracer $ mconcat
452
+ [ " Node can't find block " , textShow point
453
+ , " . It's probably behind, at "
454
+ , textShow tip, " . Sleeping for 3 mins and retrying.."
455
+ ]
456
+ threadDelay $ 180 * 1_000_000
457
+ pure $ Client. SendMsgFindIntersect [point] clientStIntersect
458
+ }
459
+ pure $ Client. SendMsgFindIntersect [point] clientStIntersect
454
460
455
461
clientStNext :: Int -> FixData -> FixData -> Client. ClientStNext CardanoBlock (Point CardanoBlock ) (Tip CardanoBlock ) IO ()
456
462
clientStNext lastSize fdOnPoint fdRest =
0 commit comments