display scanning message whenever reconcileStaged has enough files to chew on

Clear visible progress bar first.

Removed showSideActionAfter because it can't be used in reconcileStaged
(import loop). Instead, it counts the number of files it
processes and displays it after it's seen a sufficient to know it's
taking a while.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2021-06-08 12:48:30 -04:00
parent ecbaa52571
commit 7b6deb1109
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 53 additions and 36 deletions

View file

@ -100,23 +100,3 @@ mergeState st = do
uncurry addCleanupAction
Annex.Queue.mergeFrom st'
changeState $ \s -> s { errcounter = errcounter s + errcounter st' }
{- Display a message, only when the action runs for a long enough
- amount of time.
-
- The action should not display any other messages, progress, etc;
- if it did there could be some scrambling of the display since the
- message display could happen at the same time as other output,
- or after it.
-}
showSideActionAfter :: Microseconds -> String -> Annex a -> Annex a
showSideActionAfter t m a = do
waiter <- liftIO $ async $ unboundDelay t
let display = liftIO (waitCatch waiter) >>= \case
Left _ -> return ()
Right _ -> showSideAction m
displayer <- liftIO . async =<< forkState display
let cleanup = do
liftIO $ cancel waiter
join (liftIO (wait displayer))
a `finally` cleanup