File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -757,7 +757,7 @@ withTransferrableReadAccess h rr f = getEnv h $ \ldbEnv -> do
757757 -- This TVar will be used to maybe release the read lock by the resource
758758 -- registry. Once the forker was opened it will be emptied.
759759 tv <- newTVarIO (pure () )
760- void $
760+ (rk, _) <-
761761 allocate
762762 rr
763763 ( \ _ -> atomically $ do
@@ -771,7 +771,7 @@ withTransferrableReadAccess h rr f = getEnv h $ \ldbEnv -> do
771771 -- the forker was opened.
772772 join $ readTVarIO tv
773773 )
774- unsafeRunReadLocked (acquireAtTarget ldbEnv f >>= traverse (newForker h ldbEnv tv rr))
774+ unsafeRunReadLocked (acquireAtTarget ldbEnv f >>= traverse (newForker h ldbEnv (rk, tv) rr))
775775
776776-- | Acquire both a value handle and a db changelog at the tip. Holds a read lock
777777-- while doing so.
@@ -839,11 +839,11 @@ newForker ::
839839 ) =>
840840 LedgerDBHandle m l blk ->
841841 LedgerDBEnv m l blk ->
842- StrictTVar m (m () ) ->
842+ ( ResourceKey m , StrictTVar m (m () )) ->
843843 ResourceRegistry m ->
844844 DbChangelog l ->
845845 ReadLocked m (Forker m l blk )
846- newForker h ldbEnv releaseVar rr dblog =
846+ newForker h ldbEnv (rk, releaseVar) rr dblog =
847847 readLocked $
848848 fmap snd $
849849 allocate
@@ -869,6 +869,7 @@ newForker h ldbEnv releaseVar rr dblog =
869869 -- so that it is the forker the one that takes care of releasing
870870 -- it.
871871 writeTVar releaseVar (pure () )
872+ void $ release rk
872873 traceWith (foeTracer forkerEnv) ForkerOpen
873874 pure $ (mkForker h (ldbQueryBatchSize ldbEnv) forkerKey forkerEnv)
874875 )
You can’t perform that action at this time.
0 commit comments