From f50311bd03383e408a65857d4994f1e05c5229aa Mon Sep 17 00:00:00 2001 From: voidlizard Date: Mon, 20 Jan 2025 15:44:07 +0300 Subject: [PATCH] wip --- hbs2-git3/app/GitRemoteHelper.hs | 10 +++++++++- hbs2-git3/lib/HBS2/Git3/Import.hs | 6 ++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hbs2-git3/app/GitRemoteHelper.hs b/hbs2-git3/app/GitRemoteHelper.hs index 6680c45e..38abd54b 100644 --- a/hbs2-git3/app/GitRemoteHelper.hs +++ b/hbs2-git3/app/GitRemoteHelper.hs @@ -112,7 +112,15 @@ localDict DeferredOps{..} = makeDict @C do debug $ red "REFLOG" <+> pretty (AsBase58 reflog) - importGitRefLog + t0 <- getTimeCoarse + + flip fix 0 $ \next i -> do + importGitRefLog >>= \case + Just{} -> none + Nothing -> do + notice "wait for data..." + pause @'Seconds 2.0 + next (succ i) rrefs <- importedRefs diff --git a/hbs2-git3/lib/HBS2/Git3/Import.hs b/hbs2-git3/lib/HBS2/Git3/Import.hs index c1be86a4..3f7c01f1 100644 --- a/hbs2-git3/lib/HBS2/Git3/Import.hs +++ b/hbs2-git3/lib/HBS2/Git3/Import.hs @@ -112,7 +112,7 @@ importGitRefLog :: forall m . ( HBS2GitPerks m , HasGitRemoteKey m , MonadReader Git3Env m ) - => m () + => m (Maybe HashRef) importGitRefLog = do @@ -145,7 +145,7 @@ importGitRefLog = do else do next (xs, l) - void $ runMaybeT do + runMaybeT do cp <- toMPlus cp' notice $ "found checkpoint" <+> pretty cp txs <- lift $ txList ( pure . not . flip HS.member excl ) (Just cp) @@ -164,3 +164,5 @@ importGitRefLog = do updateImportedCheckpoint cp + pure cp +