git-annex/Assistant/Threads/Transferrer.hs

28 lines
771 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 GPL version 3 or higher.
-}
module Assistant.Threads.Transferrer where
import Assistant.Common
2012-07-05 20:34:20 +00:00
import Assistant.TransferQueue
import Assistant.TransferSlots
2012-07-05 20:34:20 +00:00
import Logs.Transfer
2013-04-23 15:38:52 +00:00
import Config.Files
import Utility.Batch
2012-07-05 20:34:20 +00:00
{- Dispatches transfers from the queue. -}
transfererThread :: NamedThread
transfererThread = namedThread "Transferrer" $ do
program <- liftIO readProgramFile
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