summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/Alert.hs7
-rw-r--r--Assistant/Threads/TransferScanner.hs17
2 files changed, 17 insertions, 7 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index 206694031..25ddaf3ce 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -240,6 +240,13 @@ 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 d328ba197..28490e4e4 100644
--- a/Assistant/Threads/TransferScanner.hs
+++ b/Assistant/Threads/TransferScanner.hs
@@ -14,6 +14,7 @@ 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)
@@ -38,13 +39,15 @@ transferScannerThread = namedThread "TransferScanner" $ do
go scanned = do
liftIO $ threadDelaySeconds (Seconds 2)
(rs, infos) <- unzip <$> getScanRemote
- 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
+ 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
{- All git remotes are synced, and all available remotes
- are scanned in full on startup, for multiple reasons, including:
-