assistant: Stop any transfers the assistant initiated on shutdown.
This commit is contained in:
parent
3369af61ba
commit
d8f8aa6921
2 changed files with 16 additions and 7 deletions
|
@ -13,6 +13,7 @@ import Assistant.WebApp.Common
|
|||
import Locations.UserConfig
|
||||
import Utility.LogFile
|
||||
import Assistant.DaemonStatus
|
||||
import Assistant.WebApp.Utility
|
||||
|
||||
import Control.Concurrent
|
||||
import System.Posix (getProcessID, signalProcess, sigTERM)
|
||||
|
@ -23,13 +24,20 @@ getShutdownR = page "Shutdown" Nothing $
|
|||
$(widgetFile "control/shutdown")
|
||||
|
||||
getShutdownConfirmedR :: Handler RepHtml
|
||||
getShutdownConfirmedR = page "Shutdown" Nothing $ do
|
||||
{- Wait 2 seconds before shutting down, to give the web page time
|
||||
- to display. -}
|
||||
void $ liftIO $ forkIO $ do
|
||||
threadDelay 2000000
|
||||
signalProcess sigTERM =<< getProcessID
|
||||
$(widgetFile "control/shutdownconfirmed")
|
||||
getShutdownConfirmedR = do
|
||||
{- Stop transfers the assistant is running,
|
||||
- otherwise they would continue past shutdown.
|
||||
- Pausing transfers prevents more being started up (and stops
|
||||
- the transfer processes). -}
|
||||
ts <- liftAssistant $ M.keys . currentTransfers <$> getDaemonStatus
|
||||
mapM_ pauseTransfer ts
|
||||
page "Shutdown" Nothing $ do
|
||||
{- Wait 2 seconds before shutting down, to give the web
|
||||
- page time to load in the browser. -}
|
||||
void $ liftIO $ forkIO $ do
|
||||
threadDelay 2000000
|
||||
signalProcess sigTERM =<< getProcessID
|
||||
$(widgetFile "control/shutdownconfirmed")
|
||||
|
||||
{- Quite a hack, and doesn't redirect the browser window. -}
|
||||
getRestartR :: Handler RepHtml
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -17,6 +17,7 @@ git-annex (4.20130406) UNRELEASED; urgency=low
|
|||
* The version number is now derived from git, unless built with
|
||||
VERSION_FROM_CHANGELOG.
|
||||
* webapp: Added animations.
|
||||
* assistant: Stop any transfers the assistant initiated on shutdown.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400
|
||||
|
||||
|
|
Loading…
Reference in a new issue