Skip to content

Commit fe05fc5

Browse files
committed
Take less snapshots during ledger replay
1 parent 368e8e6 commit fe05fc5

File tree

1 file changed

+6
-4
lines changed
  • cardano-db-sync/src/Cardano/DbSync/Ledger

1 file changed

+6
-4
lines changed

cardano-db-sync/src/Cardano/DbSync/Ledger/State.hs

+6-4
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,12 @@ storeSnapshotAndCleanupMaybe env oldState appResult blkNo isCons syncState =
332332
case maybeFromStrict (apNewEpoch appResult) of
333333
Just newEpoch
334334
| newEpochNo <- unEpochNo (Generic.neEpoch newEpoch)
335-
, newEpochNo > 0 -> do
336-
-- TODO: Instead of newEpochNo - 1, is there any way to get the epochNo from 'lssOldState'?
337-
liftIO $ saveCleanupState env oldState (Just $ EpochNo $ newEpochNo - 1)
338-
pure True
335+
, newEpochNo > 0
336+
, isCons || (newEpochNo `mod` 10 == 0) || newEpochNo >= 503 ->
337+
do
338+
-- TODO: Instead of newEpochNo - 1, is there any way to get the epochNo from 'lssOldState'?
339+
liftIO $ saveCleanupState env oldState (Just $ EpochNo $ newEpochNo - 1)
340+
pure True
339341
_ ->
340342
if timeToSnapshot syncState blkNo && isCons
341343
then do

0 commit comments

Comments
 (0)