git-annex/Assistant/Threads/Transferrer.hs

28 lines
767 B
Haskell
Raw Normal View History

2012-07-05 20:34:20 +00:00
{- git-annex assistant data transferrer thread
-
- Copyright 2012 Joey Hess <id@joeyh.name>
2012-07-05 20:34:20 +00:00
-
- Licensed under the GNU AGPL version 3 or higher.
2012-07-05 20:34:20 +00:00
-}
module Assistant.Threads.Transferrer where
import Assistant.Common
2012-07-05 20:34:20 +00:00
import Assistant.TransferQueue
import Assistant.TransferSlots
import Types.Transfer
import Annex.Path
import Utility.Batch
2012-07-05 20:34:20 +00:00
{- Dispatches transfers from the queue. -}
transfererThread :: NamedThread
transfererThread = namedThread "Transferrer" $ do
program <- liftIO programPath
batchmaker <- liftIO getBatchCommandMaker
forever $ inTransferSlot program batchmaker $
2013-10-03 02:59:07 +00:00
maybe (return Nothing) (uncurry genTransfer)
=<< getNextTransfer notrunning
where
{- Skip transfers that are already running. -}
notrunning = isNothing . startedTime