summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Transferrer.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
commitb48d7747a3ac8bea7d58e8fff8faf791f98699c0 (patch)
treef5662f9161fd3c74c2f6467be270651d92ac3ead /Assistant/Threads/Transferrer.hs
parent42e73537d1977eac2da2760647e9131f5c9b9eed (diff)
debugging improvements
add timestamps to debug messages Add lots of debug output in the assistant's threads.
Diffstat (limited to 'Assistant/Threads/Transferrer.hs')
-rw-r--r--Assistant/Threads/Transferrer.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs
index c439d8b7e..4ee5290e1 100644
--- a/Assistant/Threads/Transferrer.hs
+++ b/Assistant/Threads/Transferrer.hs
@@ -7,7 +7,7 @@
module Assistant.Threads.Transferrer where
-import Common.Annex
+import Assistant.Common
import Assistant.ThreadedMonad
import Assistant.DaemonStatus
import Assistant.TransferQueue
@@ -22,6 +22,9 @@ import Data.Time.Clock.POSIX
import Data.Time.Clock
import qualified Data.Map as M
+thisThread :: ThreadName
+thisThread = "Transferrer"
+
{- For now only one transfer is run at a time. -}
maxTransfers :: Int
maxTransfers = 1
@@ -32,8 +35,12 @@ transfererThread st dstatus transferqueue slots = go
where
go = do
(t, info) <- getNextTransfer transferqueue
- whenM (runThreadState st $ shouldTransfer dstatus t info) $
- runTransfer st dstatus slots t info
+ ifM (runThreadState st $ shouldTransfer dstatus t info)
+ ( do
+ debug thisThread [ "Transferring:" , show t ]
+ runTransfer st dstatus slots t info
+ , debug thisThread [ "Skipping unnecessary transfer:" , show t ]
+ )
go
{- Checks if the requested transfer is already running, or