From 8374fb5a3abff77bad4fdf473fe6be29901545ba Mon Sep 17 00:00:00 2001 From: voidlizard Date: Sun, 24 Aug 2025 09:01:21 +0300 Subject: [PATCH] fixing stucked garbage problem --- hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/State.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/State.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/State.hs index c317d076..c3073bdc 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/State.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/State.hs @@ -54,24 +54,25 @@ ncqStateUpdateLoop ncq@NCQStorage{..} = do debug $ red "ncqStateUpdateLoop" + ncqStateDump ncq - sInit <- readTVarIO ncqState + sInit <- readTVarIO ncqState <&> ncqStateVersion flip fix sInit $ \next s0 -> do state <- atomically do - s1 <- readTVar ncqState + s1 <- readTVar ncqState <&> ncqStateVersion stop <- readTVar ncqStopReq dump <- readTVar ncqStateDumpReq if s1 == s0 && not stop && not dump then STM.retry else pure s1 - key <- ncqStateDump ncq + ncqStateDump ncq done <- atomically do modifyTVar ncqWrites succ readTVar ncqStopReq unless done do - next =<< readTVarIO ncqState + next state ncqStateUpdate :: MonadIO m => NCQStorage