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 Locations.UserConfig
|
||||||
import Utility.LogFile
|
import Utility.LogFile
|
||||||
import Assistant.DaemonStatus
|
import Assistant.DaemonStatus
|
||||||
|
import Assistant.WebApp.Utility
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import System.Posix (getProcessID, signalProcess, sigTERM)
|
import System.Posix (getProcessID, signalProcess, sigTERM)
|
||||||
|
@ -23,13 +24,20 @@ getShutdownR = page "Shutdown" Nothing $
|
||||||
$(widgetFile "control/shutdown")
|
$(widgetFile "control/shutdown")
|
||||||
|
|
||||||
getShutdownConfirmedR :: Handler RepHtml
|
getShutdownConfirmedR :: Handler RepHtml
|
||||||
getShutdownConfirmedR = page "Shutdown" Nothing $ do
|
getShutdownConfirmedR = do
|
||||||
{- Wait 2 seconds before shutting down, to give the web page time
|
{- Stop transfers the assistant is running,
|
||||||
- to display. -}
|
- otherwise they would continue past shutdown.
|
||||||
void $ liftIO $ forkIO $ do
|
- Pausing transfers prevents more being started up (and stops
|
||||||
threadDelay 2000000
|
- the transfer processes). -}
|
||||||
signalProcess sigTERM =<< getProcessID
|
ts <- liftAssistant $ M.keys . currentTransfers <$> getDaemonStatus
|
||||||
$(widgetFile "control/shutdownconfirmed")
|
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. -}
|
{- Quite a hack, and doesn't redirect the browser window. -}
|
||||||
getRestartR :: Handler RepHtml
|
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
|
* The version number is now derived from git, unless built with
|
||||||
VERSION_FROM_CHANGELOG.
|
VERSION_FROM_CHANGELOG.
|
||||||
* webapp: Added animations.
|
* 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
|
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue