finish CommandStart transition

The hoped for optimisation of CommandStart with -J did not materialize.
In fact, not runnign CommandStart in parallel is slower than -J3.
So, CommandStart are still run in parallel.

(The actual bad performance I've been seeing with -J in my big repo
has to do with building the remoteList.)

But, this is still progress toward making -J faster, because it gets rid
of the onlyActionOn roadblock in the way of making CommandCleanup jobs
run separate from CommandPerform jobs.

Added OnlyActionOn constructor for ActionItem which fixes the
onlyActionOn breakage in the last commit.

Made CustomOutput include an ActionItem, so even things using it can
specify OnlyActionOn.

In Command.Move and Command.Sync, there were CommandStarts that used
includeCommandAction, so output messages, which is no longer allowed.
Fixed by using startingCustomOutput, but that's still not quite right,
since it prevents message display for the includeCommandAction run
inside it too.
This commit is contained in:
Joey Hess 2019-06-12 09:23:26 -04:00
parent 436f107715
commit 8e5ea28c26
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
26 changed files with 142 additions and 97 deletions

View file

@ -108,8 +108,9 @@ toStart' dest removewhen afile key ai = do
)
else go False (Remote.hasKey dest key)
where
go fastcheck isthere = starting (describeMoveAction removewhen) ai $
toPerform dest removewhen key afile fastcheck =<< isthere
go fastcheck isthere =
starting (describeMoveAction removewhen) (OnlyActionOn key ai) $
toPerform dest removewhen key afile fastcheck =<< isthere
expectedPresent :: Remote -> Key -> Annex Bool
expectedPresent dest key = do
@ -182,7 +183,7 @@ fromStart removewhen afile key ai src = case removewhen of
RemoveSafe -> go
where
go = stopUnless (fromOk src key) $
starting (describeMoveAction removewhen) ai $
starting (describeMoveAction removewhen) (OnlyActionOn key ai) $
fromPerform src removewhen key afile
fromOk :: Remote -> Key -> Annex Bool
@ -246,13 +247,13 @@ toHereStart removewhen afile key ai = case removewhen of
RemoveNever -> stopUnless (not <$> inAnnex key) go
RemoveSafe -> go
where
go = do
go = startingCustomOutput (OnlyActionOn key ai) $ do
rs <- Remote.keyPossibilities key
forM_ rs $ \r ->
includeCommandAction $
starting (describeMoveAction removewhen) ai $
fromPerform r removewhen key afile
stop
next $ return True
{- The goal of this command is to allow the user maximum freedom to move
- files as they like, while avoiding making bad situations any worse