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

@ -14,6 +14,7 @@ import Assistant.Alert
import Assistant.Pairing
import Utility.NotificationBroadcaster
import Logs.Transfer
import Assistant.Types.ThreadName
import Control.Concurrent.STM
import Control.Concurrent.Async
@ -21,8 +22,9 @@ import Data.Time.Clock.POSIX
import qualified Data.Map as M
data DaemonStatus = DaemonStatus
-- All the named threads that comprise the daemon.
{ startedThreads :: M.Map String (Async ())
-- All the named threads that comprise the daemon,
-- and actions to run to restart them.
{ startedThreads :: M.Map ThreadName (Async (), IO ())
-- False when the daemon is performing its startup scan
, scanComplete :: Bool
-- Time when a previous process of the daemon was running ok

View file

@ -0,0 +1,17 @@
{- named threads
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Assistant.Types.NamedThread where
import Assistant.Monad
import Assistant.Types.ThreadName
{- Information about a named thread that can be run. -}
data NamedThread = NamedThread ThreadName (Assistant ())
namedThread :: String -> Assistant () -> NamedThread
namedThread name a = NamedThread (ThreadName name) a

View file

@ -0,0 +1,14 @@
{- name of a thread
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Assistant.Types.ThreadName where
newtype ThreadName = ThreadName String
deriving (Eq, Read, Show, Ord)
fromThreadName :: ThreadName -> String
fromThreadName (ThreadName n) = n