summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-19 12:51:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-19 13:03:41 -0400
commit09e65da8e2b4e3b81a1d1772a9d490fcda22a7a6 (patch)
treee57bec364ae1fc89f8092c9bd076bafa84001cc4 /Assistant
parentb5ca4df9ecf906e6640be362708face2215b5469 (diff)
move display of transfer scan in progress to transfers section of dashboard
This way it's only visible when transfers are not running, which is about what a user would expect.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Alert.hs7
-rw-r--r--Assistant/Threads/TransferScanner.hs25
-rw-r--r--Assistant/Types/DaemonStatus.hs3
3 files changed, 18 insertions, 17 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index 25ddaf3ce..206694031 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -240,13 +240,6 @@ commitAlert = activityAlert Nothing
showRemotes :: [Remote] -> TenseChunk
showRemotes = UnTensed . T.intercalate ", " . map (T.pack . Remote.name)
-scanAlert :: Alert
-scanAlert = baseActivityAlert
- { alertHeader = Just $
- tenseWords [Tensed "Scanning" "Scanned", "for file transfers"]
- , alertPriority = Low
- }
-
syncAlert :: [Remote] -> Alert
syncAlert rs = baseActivityAlert
{ alertName = Just SyncAlert
diff --git a/Assistant/Threads/TransferScanner.hs b/Assistant/Threads/TransferScanner.hs
index 28490e4e4..4698a0d30 100644
--- a/Assistant/Threads/TransferScanner.hs
+++ b/Assistant/Threads/TransferScanner.hs
@@ -14,13 +14,13 @@ import Assistant.TransferQueue
import Assistant.DaemonStatus
import Assistant.Drop
import Assistant.Sync
-import Assistant.Alert
import Logs.Transfer
import Logs.Location
import Logs.Web (webUUID)
import qualified Remote
import qualified Types.Remote as Remote
import Utility.ThreadScheduler
+import Utility.NotificationBroadcaster
import qualified Git.LsFiles as LsFiles
import qualified Backend
import Annex.Content
@@ -37,17 +37,22 @@ transferScannerThread = namedThread "TransferScanner" $ do
go S.empty
where
go scanned = do
+ scanrunning False
liftIO $ threadDelaySeconds (Seconds 2)
(rs, infos) <- unzip <$> getScanRemote
- void $ alertWhile scanAlert $ do
- if any fullScan infos || any (`S.notMember` scanned) rs
- then do
- expensiveScan rs
- go $ scanned `S.union` S.fromList rs
- else do
- mapM_ failedTransferScan rs
- go scanned
- return True
+ scanrunning True
+ if any fullScan infos || any (`S.notMember` scanned) rs
+ then do
+ expensiveScan rs
+ go $ scanned `S.union` S.fromList rs
+ else do
+ mapM_ failedTransferScan rs
+ go scanned
+ scanrunning b = do
+ ds <- modifyDaemonStatus $ \s ->
+ (s { transferScanRunning = b }, s)
+ liftIO $ sendNotification $ transferNotifier ds
+
{- All git remotes are synced, and all available remotes
- are scanned in full on startup, for multiple reasons, including:
-
diff --git a/Assistant/Types/DaemonStatus.hs b/Assistant/Types/DaemonStatus.hs
index 0fc800a37..99baf1572 100644
--- a/Assistant/Types/DaemonStatus.hs
+++ b/Assistant/Types/DaemonStatus.hs
@@ -35,6 +35,8 @@ data DaemonStatus = DaemonStatus
, sanityCheckRunning :: Bool
-- Last time the sanity checker ran
, lastSanityCheck :: Maybe POSIXTime
+ -- True when a scan for file transfers is running
+ , transferScanRunning :: Bool
-- Currently running file content transfers
, currentTransfers :: TransferMap
-- Messages to display to the user.
@@ -77,6 +79,7 @@ newDaemonStatus = DaemonStatus
<*> pure Nothing
<*> pure False
<*> pure Nothing
+ <*> pure False
<*> pure M.empty
<*> pure M.empty
<*> pure firstAlertId