webapp: Now allows restarting any threads that crash.

This commit is contained in:
Joey Hess 2013-01-26 17:09:33 +11:00
parent 07717a9b2b
commit 76ddf9b6d3
30 changed files with 124 additions and 61 deletions

View file

@ -12,9 +12,11 @@ module Assistant.WebApp.Control where
import Assistant.WebApp.Common
import Locations.UserConfig
import Utility.LogFile
import Assistant.DaemonStatus
import Control.Concurrent
import System.Posix (getProcessID, signalProcess, sigTERM)
import qualified Data.Map as M
getShutdownR :: Handler RepHtml
getShutdownR = page "Shutdown" Nothing $
@ -42,6 +44,12 @@ getRestartR = page "Restarting" Nothing $ do
restartcommand program = program ++ " assistant --stop; " ++
program ++ " webapp"
getRestartThreadR :: ThreadName -> Handler ()
getRestartThreadR name = do
m <- liftAssistant $ startedThreads <$> getDaemonStatus
liftIO $ maybe noop snd $ M.lookup name m
redirectBack
getLogR :: Handler RepHtml
getLogR = page "Logs" Nothing $ do
logfile <- lift $ runAnnex undefined $ fromRepo gitAnnexLogFile