450ee53ab6
Most of the time, there will be no discreprancy between programPath and readProgramFile. But, the programFile might have been written by an old version of git-annex that is still installed, while a newer one is currently running. In this case, we want to run the same one that's currently running. This is especially important for things like the GIT_SSH=git-annex used for ssh connection caching. The only code that still uses readProgramFile directly is the upgrade code, which needs to know where the standalone git-annex was installed, in order to upgrade it.
27 lines
765 B
Haskell
27 lines
765 B
Haskell
{- git-annex assistant data transferrer thread
|
|
-
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Assistant.Threads.Transferrer where
|
|
|
|
import Assistant.Common
|
|
import Assistant.TransferQueue
|
|
import Assistant.TransferSlots
|
|
import Logs.Transfer
|
|
import Annex.Path
|
|
import Utility.Batch
|
|
|
|
{- Dispatches transfers from the queue. -}
|
|
transfererThread :: NamedThread
|
|
transfererThread = namedThread "Transferrer" $ do
|
|
program <- liftIO programPath
|
|
batchmaker <- liftIO getBatchCommandMaker
|
|
forever $ inTransferSlot program batchmaker $
|
|
maybe (return Nothing) (uncurry genTransfer)
|
|
=<< getNextTransfer notrunning
|
|
where
|
|
{- Skip transfers that are already running. -}
|
|
notrunning = isNothing . startedTime
|