From 2349ec4157253afa52c47c4d902f74b9ae124d3c Mon Sep 17 00:00:00 2001 From: voidlizard Date: Wed, 15 Jan 2025 08:24:29 +0300 Subject: [PATCH] wip, export checkpoints --- hbs2-git3/lib/HBS2/Git3/State/Index.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hbs2-git3/lib/HBS2/Git3/State/Index.hs b/hbs2-git3/lib/HBS2/Git3/State/Index.hs index 69ed37d6..831dc1f2 100644 --- a/hbs2-git3/lib/HBS2/Git3/State/Index.hs +++ b/hbs2-git3/lib/HBS2/Git3/State/Index.hs @@ -17,6 +17,7 @@ import Data.Heap (Entry(..)) import Data.Heap qualified as Heap import Data.ByteString.Lazy qualified as LBS import Data.Fixed +import Data.Either import Data.Maybe import Data.HashMap.Strict (HashMap) import Data.HashMap.Strict qualified as HM @@ -340,8 +341,12 @@ updateReflogIndex = do lbs <- liftIO (runExceptT (getTreeContents sto href)) >>= orThrow MissedBlockError - pieces <- S.toList_ do - void $ runConsumeLBS (ZstdL.decompress lbs) $ readLogFileLBS () $ \o s _ -> do + -- ignoring broken txs + unzstd <- liftIO (try @_ @SomeException (pure $ ZstdL.decompress lbs) + <&> fromRight mempty ) + + pieces <- S.toList_ $ do + void $ runConsumeLBS unzstd $ readLogFileLBS () $ \o _ _ -> do lift $ S.yield o lift $ S.yield (h, pieces)