diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-22 16:04:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-22 16:04:20 -0400 |
commit | b45b9d64280be90e552a187ab2e99a2e77f8346f (patch) | |
tree | 44d8b76f84013d2d3ceedb2295e540efec9ed337 /Assistant/Threads | |
parent | 8e6e6c47702e2af19b2b319b0ebc37e5a749ff27 (diff) |
annex.autoupgrade setting
Diffstat (limited to 'Assistant/Threads')
-rw-r--r-- | Assistant/Threads/Upgrader.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Assistant/Threads/Upgrader.hs b/Assistant/Threads/Upgrader.hs index 95000fbef..c6cf82520 100644 --- a/Assistant/Threads/Upgrader.hs +++ b/Assistant/Threads/Upgrader.hs @@ -17,6 +17,7 @@ import Assistant.DaemonStatus import Assistant.Alert import Utility.NotificationBroadcaster import Utility.Tmp +import qualified Annex import qualified Build.SysConfig import qualified Utility.Url as Url import qualified Annex.Url as Url @@ -31,6 +32,7 @@ import qualified Data.Text as T upgraderThread :: UrlRenderer -> NamedThread upgraderThread urlrenderer = namedThread "Upgrader" $ do + checkUpgrade urlrenderer when (isJust Build.SysConfig.upgradelocation) $ do h <- liftIO . newNotificationHandle False . networkConnectedNotifier =<< getDaemonStatus go h Nothing @@ -40,12 +42,16 @@ upgraderThread urlrenderer = namedThread "Upgrader" $ do - check. -} go h lastchecked = do liftIO $ waitNotification h - now <- liftIO getCurrentTime - if maybe True (\t -> diffUTCTime now t > halfday) lastchecked - then do - checkUpgrade urlrenderer - go h =<< Just <$> liftIO getCurrentTime - else go h lastchecked + autoupgrade <- liftAnnex $ annexAutoUpgrade <$> Annex.getGitConfig + if autoupgrade == NoAutoUpgrade + then go h lastchecked + else do + now <- liftIO getCurrentTime + if maybe True (\t -> diffUTCTime now t > halfday) lastchecked + then do + checkUpgrade urlrenderer + go h =<< Just <$> liftIO getCurrentTime + else go h lastchecked halfday = 12 * 60 * 60 checkUpgrade :: UrlRenderer -> Assistant () |