new alert while scanning
Like the old one, but does not mention which remotes are scanned. I think this is less confusing, as it does not imply the remotes were somehow accessed (which they are not; inaccessible remotes can be scanned.)
This commit is contained in:
parent
aadb9069b3
commit
a30768cf7f
2 changed files with 17 additions and 7 deletions
|
@ -240,6 +240,13 @@ commitAlert = activityAlert Nothing
|
||||||
showRemotes :: [Remote] -> TenseChunk
|
showRemotes :: [Remote] -> TenseChunk
|
||||||
showRemotes = UnTensed . T.intercalate ", " . map (T.pack . Remote.name)
|
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 :: [Remote] -> Alert
|
||||||
syncAlert rs = baseActivityAlert
|
syncAlert rs = baseActivityAlert
|
||||||
{ alertName = Just SyncAlert
|
{ alertName = Just SyncAlert
|
||||||
|
|
|
@ -14,6 +14,7 @@ import Assistant.TransferQueue
|
||||||
import Assistant.DaemonStatus
|
import Assistant.DaemonStatus
|
||||||
import Assistant.Drop
|
import Assistant.Drop
|
||||||
import Assistant.Sync
|
import Assistant.Sync
|
||||||
|
import Assistant.Alert
|
||||||
import Logs.Transfer
|
import Logs.Transfer
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import Logs.Web (webUUID)
|
import Logs.Web (webUUID)
|
||||||
|
@ -38,13 +39,15 @@ transferScannerThread = namedThread "TransferScanner" $ do
|
||||||
go scanned = do
|
go scanned = do
|
||||||
liftIO $ threadDelaySeconds (Seconds 2)
|
liftIO $ threadDelaySeconds (Seconds 2)
|
||||||
(rs, infos) <- unzip <$> getScanRemote
|
(rs, infos) <- unzip <$> getScanRemote
|
||||||
if any fullScan infos || any (`S.notMember` scanned) rs
|
void $ alertWhile scanAlert $ do
|
||||||
then do
|
if any fullScan infos || any (`S.notMember` scanned) rs
|
||||||
expensiveScan rs
|
then do
|
||||||
go $ scanned `S.union` S.fromList rs
|
expensiveScan rs
|
||||||
else do
|
go $ scanned `S.union` S.fromList rs
|
||||||
mapM_ failedTransferScan rs
|
else do
|
||||||
go scanned
|
mapM_ failedTransferScan rs
|
||||||
|
go scanned
|
||||||
|
return True
|
||||||
{- All git remotes are synced, and all available remotes
|
{- All git remotes are synced, and all available remotes
|
||||||
- are scanned in full on startup, for multiple reasons, including:
|
- are scanned in full on startup, for multiple reasons, including:
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Reference in a new issue