summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-18 22:58:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-18 22:58:14 -0400
commit154b11d6b1900b7104809810bee2d611b2993d42 (patch)
treeb56af8cbd3e984d2f1f0ab604db89f0c43fa5b33
parentb7654c1c591454247fdf0d56e1fd8f20e9ec6c9e (diff)
deal with transferkey crashing
If transferkey crashes or even fails to run, the TransferWatcher will not see the transfer info file be created, so will not remove the transfer from the list of active transfers. This causes the list to grow continually, and all active transfers are displayed in the webapp. So, put in a guard. I assume that transferkey will not exit 0 while neglecting to clean up.
-rw-r--r--Assistant/Threads/Transferrer.hs31
1 files changed, 19 insertions, 12 deletions
diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs
index 1720b4c9c..ccca4ca5e 100644
--- a/Assistant/Threads/Transferrer.hs
+++ b/Assistant/Threads/Transferrer.hs
@@ -88,19 +88,26 @@ startTransfer program t info = case (transferRemote info, associatedFile info) o
- made, in order to queue a push of the git-annex
- branch out to remotes that did not participate
- in the transfer.
+ -
+ - If the process failed, it could have crashed,
+ - so remove the transfer from the list of current
+ - transfers, just in case it didn't stop
+ - in a way that lets the TransferWatcher do its
+ - usual cleanup.
-}
- whenM (liftIO $ (==) ExitSuccess <$> waitForProcess pid) $ do
- void $ addAlert $ makeAlertFiller True $
- transferFileAlert direction True file
- unless isdownload $
- handleDrops
- ("object uploaded to " ++ show remote)
- True (transferKey t)
- (associatedFile info)
- (Just remote)
- recordCommit
-
- void $ removeTransfer t
+ ifM (liftIO $ (==) ExitSuccess <$> waitForProcess pid)
+ ( do
+ void $ addAlert $ makeAlertFiller True $
+ transferFileAlert direction True file
+ unless isdownload $
+ handleDrops
+ ("object uploaded to " ++ show remote)
+ True (transferKey t)
+ (associatedFile info)
+ (Just remote)
+ recordCommit
+ , void $ removeTransfer t
+ )
where
params =
[ Param "transferkey"