From 2ab1535802ea2ed1ce2a3a68424cd322fa05b614 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Fri, 22 Aug 2025 21:20:11 +0300 Subject: [PATCH] wip, mac os x shit --- .../lib/HBS2/Storage/NCQ3/Internal/Run.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Run.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Run.hs index de4a723a..6dd2c771 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Run.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Run.hs @@ -247,7 +247,14 @@ ncqStorageRun ncq@NCQStorage{..} = withSem ncqRunSem $ flip runContT pure do -- debug $ viaShow s case s of RunFin mfh -> do - liftIO $ for_ mfh closeFd + liftIO $ for_ mfh $ \(fk,fh) -> do + ss <- appendTailSection fh + fileSynchronisePortable fh + flushReplaces fk + ncqStateUpdate ncq (ncqStateAddFact (P (PData (DataFile fk) ss))) + ncqStateDump ncq + closeFd fh + rest <- readTVarIO ncqWriteQ <&> Seq.length debug $ "exit storage" <+> pretty rest atomically $ pollSTM indexer >>= maybe STM.retry (const none) @@ -299,7 +306,7 @@ ncqStorageRun ncq@NCQStorage{..} = withSem ncqRunSem $ flip runContT pure do atomically $ writeTQueue indexQ fk loop RunNew - | not continue -> loop (RunFin (Just fh)) + | not continue -> loop (RunFin (Just (fk,fh))) | otherwise -> loop $ RunWrite (fk, fh, rest, total) @@ -445,7 +452,7 @@ data RunSt = RunNew | RunWrite (FileKey, Fd, Int, Int) | RunSync (FileKey, Fd, Int, Int, Bool) - | RunFin (Maybe Fd) + | RunFin (Maybe (FileKey, Fd)) deriving stock Show