Commit 00928dc2 authored by Mart Lubbers's avatar Mart Lubbers

remove updateClock backgroundtask

parent 946848f4
Pipeline #18768 passed with stage
in 6 minutes and 20 seconds
...@@ -49,17 +49,17 @@ doTasks startable world = doTasksWithOptions defaultEngineCLIOptions startable w ...@@ -49,17 +49,17 @@ doTasks startable world = doTasksWithOptions defaultEngineCLIOptions startable w
doTasksWithOptions :: ([String] EngineOptions -> MaybeError [String] EngineOptions) a !*World -> *World | Startable a doTasksWithOptions :: ([String] EngineOptions -> MaybeError [String] EngineOptions) a !*World -> *World | Startable a
doTasksWithOptions initFun startable world doTasksWithOptions initFun startable world
# (cli,world) = getCommandLine world # (cli,world) = getCommandLine world
# (options,world) = defaultEngineOptions world # (options,world) = defaultEngineOptions world
# mbOptions = initFun cli options # mbOptions = initFun cli options
| mbOptions =:(Error _) = show (fromError mbOptions) world | mbOptions =:(Error _) = show (fromError mbOptions) world
# options = fromOk mbOptions # options = fromOk mbOptions
# iworld = createIWorld options world # iworld = createIWorld options world
# (res,iworld) = initJSCompilerState iworld # (res,iworld) = initJSCompilerState iworld
| res =:(Error _) = show ["Fatal error: " +++ fromError res] (destroyIWorld iworld) | res =:(Error _) = show ["Fatal error: " +++ fromError res] (destroyIWorld iworld)
# (symbolsResult, iworld) = initSymbolsShare options.distributed options.appName iworld # (symbolsResult, iworld) = initSymbolsShare options.distributed options.appName iworld
| symbolsResult =: (Error _) = show ["Error reading symbols while required: " +++ fromError symbolsResult] (destroyIWorld iworld) | symbolsResult =: (Error _) = show ["Error reading symbols while required: " +++ fromError symbolsResult] (destroyIWorld iworld)
# iworld = serve (startupTasks options) (tcpTasks options.serverPort options.keepaliveTime) # iworld = serve (startupTasks options) (tcpTasks options.serverPort options.keepaliveTime)
engineTasks (timeout options.timeout) iworld engineTasks (timeout options.timeout) iworld
= destroyIWorld iworld = destroyIWorld iworld
where where
...@@ -79,8 +79,7 @@ where ...@@ -79,8 +79,7 @@ where
= [(serverPort,httpServer serverPort keepaliveTime (engineWebService webTasks) taskOutput)] = [(serverPort,httpServer serverPort keepaliveTime (engineWebService webTasks) taskOutput)]
engineTasks = engineTasks =
[BackgroundTask updateClock, [BackgroundTask (processEvents MAX_EVENTS)
BackgroundTask (processEvents MAX_EVENTS)
:if (webTasks =: []) :if (webTasks =: [])
[BackgroundTask stopOnStable] [BackgroundTask stopOnStable]
[BackgroundTask removeOutdatedSessions [BackgroundTask removeOutdatedSessions
......
...@@ -52,14 +52,12 @@ where ...@@ -52,14 +52,12 @@ where
updateClock :: !*IWorld -> *(!MaybeError TaskException (), !*IWorld) updateClock :: !*IWorld -> *(!MaybeError TaskException (), !*IWorld)
updateClock iworld=:{IWorld|clock,world} updateClock iworld=:{IWorld|clock,world}
//Determine current date and time //Determine current date and time
# (timespec,world) = nsTime world # (timespec,world) = nsTime world
# iworld = {iworld & world = world} # iworld & world = world
//Write SDS if necessary //Write SDS if necessary
# (mbe,iworld) = write timespec (sdsFocus {start=zero,interval=zero} iworldTimespec) EmptyContext iworld # (mbe,iworld) = write timespec (sdsFocus {start=zero,interval=zero} iworldTimespec) EmptyContext iworld
= case mbe of = (() <$ mbe, iworld)
(Error e ) -> (Error e, iworld)
(_) -> (Ok (), iworld)
//When we run the built-in HTTP server we need to do active garbage collection of instances that were created for sessions //When we run the built-in HTTP server we need to do active garbage collection of instances that were created for sessions
removeOutdatedSessions :: !*IWorld -> *(!MaybeError TaskException (), !*IWorld) removeOutdatedSessions :: !*IWorld -> *(!MaybeError TaskException (), !*IWorld)
......
...@@ -10,6 +10,7 @@ import qualified Data.Map as DM ...@@ -10,6 +10,7 @@ import qualified Data.Map as DM
import qualified iTasks.Internal.SDS as SDS import qualified iTasks.Internal.SDS as SDS
import TCPChannelClass, TCPChannels, TCPEvent, TCPStringChannels, TCPDef, tcp import TCPChannelClass, TCPChannels, TCPEvent, TCPStringChannels, TCPDef, tcp
import iTasks.Internal.EngineTasks
import iTasks.Engine, iTasks.Internal.IWorld, iTasks.Internal.TaskEval, iTasks.Internal.TaskStore import iTasks.Engine, iTasks.Internal.IWorld, iTasks.Internal.TaskEval, iTasks.Internal.TaskStore
import iTasks.Internal.IWorld import iTasks.Internal.IWorld
import iTasks.Internal.Task import iTasks.Internal.Task
...@@ -78,8 +79,10 @@ loop determineTimeout iworld=:{ioTasks,sdsNotifyRequests} ...@@ -78,8 +79,10 @@ loop determineTimeout iworld=:{ioTasks,sdsNotifyRequests}
# (mbTimeout,iworld=:{IWorld|ioTasks={todo},world}) = determineTimeout {iworld & ioTasks = {done=[], todo = ioTasks.todo ++ (reverse ioTasks.done)}} # (mbTimeout,iworld=:{IWorld|ioTasks={todo},world}) = determineTimeout {iworld & ioTasks = {done=[], todo = ioTasks.todo ++ (reverse ioTasks.done)}}
//Check which mainloop tasks have data available //Check which mainloop tasks have data available
# (todo,chList,world) = select mbTimeout todo world # (todo,chList,world) = select mbTimeout todo world
# (merr, iworld) = updateClock {iworld & ioTasks = {done=[],todo=todo}, world = world}
| merr=:(Error _) = abort "Error updating clock"
//Process the select result //Process the select result
# iworld =:{shutdown,ioTasks={done}} = process 0 chList {iworld & ioTasks = {done=[],todo=todo}, world = world} # iworld =:{shutdown,ioTasks={done}} = process 0 chList iworld
//Move everything from the done list back to the todo list //Move everything from the done list back to the todo list
# iworld = {iworld & ioTasks={todo = reverse done,done=[]}} # iworld = {iworld & ioTasks={todo = reverse done,done=[]}}
//Everything needs to be re-evaluated //Everything needs to be re-evaluated
...@@ -153,7 +156,7 @@ where ...@@ -153,7 +156,7 @@ where
= (n + 1,[x:xs]) = (n + 1,[x:xs])
//TODO: Use share notification to trigger task re-evaluation based on io events //TODO: Use share notification to trigger task re-evaluation based on io events
process :: !Int [(!Int,!SelectResult)] !*IWorld -> !*IWorld process :: !Int [(!Int,!SelectResult)] !*IWorld -> *IWorld
process i chList iworld=:{ioTasks={done,todo=[]}} = iworld process i chList iworld=:{ioTasks={done,todo=[]}} = iworld
process i chList iworld=:{ioTasks={done,todo=[ListenerInstance lopts listener:todo]},ioStates,world} process i chList iworld=:{ioTasks={done,todo=[ListenerInstance lopts listener:todo]},ioStates,world}
# taskId=:(TaskId instanceNo _) = lopts.ListenerInstanceOpts.taskId # taskId=:(TaskId instanceNo _) = lopts.ListenerInstanceOpts.taskId
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment