Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Make the PAB log ~1/10_000 messages.
Browse files Browse the repository at this point in the history
The way it was configured rarely if ever prints anything.
  • Loading branch information
raduom committed Jan 27, 2022
1 parent 51da951 commit 5757b92
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plutus-pab/plutus-pab.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ library
ouroboros-network-framework -any,
prettyprinter >=1.1.0.1,
quickcheck-instances -any,
random -any,
row-types -any,
servant -any,
servant-client -any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import Plutus.ChainIndex.Compatibility (fromCardanoBlockHeader, fromCardanoPoint
import Plutus.ChainIndex.TxIdState qualified as TxIdState
import Plutus.ChainIndex.TxOutBalance qualified as TxOutBalance
import Plutus.Contract.CardanoAPI (fromCardanoTx)
import System.Random

-- | Connect to the node and write node updates to the blockchain
-- env.
Expand Down Expand Up @@ -78,7 +79,9 @@ handleSyncAction action = do
-- we start logging from here to avoid spamming the terminal
-- should be removed when we have better logging to report
-- on the PAB sync status
if (n `mod` 100_000 == 0 && n > 0) || (s >= recentSlot)
stdGen <- newStdGen
let logBlock = fst (randomR (0 :: Int, 10_000) stdGen) == 0
if logBlock || (s >= recentSlot)
then do
putStrLn $ "Current block: " <> show n <> ". Current slot: " <> show s
else pure ()
Expand Down

0 comments on commit 5757b92

Please sign in to comment.