Skip to content

Commit 345d314

Browse files
committed
Use single forker in storeLedgerStateAt
1 parent 241b90c commit 345d314

File tree

1 file changed

+5
-3
lines changed
  • ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser

1 file changed

+5
-3
lines changed

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Analysis.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ storeLedgerStateAt slotNo ledgerAppMode env = do
444444
Left{} -> error "Unreachable, volatile tip MUST be in the LedgerDB"
445445
Right f -> pure f
446446
tbs <- LedgerDB.forkerReadTables frk (getBlockKeySets blk)
447-
LedgerDB.forkerClose frk
448-
case runExcept $ tickThenXApply OmitLedgerEvents ledgerCfg blk (oldLedger `withLedgerTables` tbs) of
447+
r <- case runExcept $ tickThenXApply OmitLedgerEvents ledgerCfg blk (oldLedger `withLedgerTables` tbs) of
449448
Right newLedger -> do
450-
LedgerDB.push internal newLedger
449+
LedgerDB.forkerPush frk newLedger
450+
IOLike.atomically $ LedgerDB.forkerCommit frk
451451
when (blockSlot blk >= slotNo) storeLedgerState
452452
when (blockSlot blk > slotNo) $ issueWarning blk
453453
when ((unBlockNo $ blockNo blk) `mod` 1000 == 0) $ reportProgress blk
@@ -457,6 +457,8 @@ storeLedgerStateAt slotNo ledgerAppMode env = do
457457
traceWith tracer $ LedgerErrorEvent (blockPoint blk) err
458458
storeLedgerState
459459
pure (Stop, ())
460+
LedgerDB.forkerClose frk
461+
pure r
460462

461463
tickThenXApply = case ledgerAppMode of
462464
LedgerReapply -> pure ...: tickThenReapply

0 commit comments

Comments
 (0)