summaryrefslogtreecommitdiff
path: root/Omni/Agent/Worker.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Agent/Worker.hs')
-rw-r--r--Omni/Agent/Worker.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index 7266162..c9a7563 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -19,11 +19,11 @@ import qualified System.Process as Process
start :: Core.Worker -> IO ()
start worker = do
AgentLog.init (Core.workerName worker)
- AgentLog.log ("Worker starting loop for " <> Core.workerName worker)
- loop worker
+ AgentLog.log ("Worker starting for " <> Core.workerName worker)
+ runOnce worker
-loop :: Core.Worker -> IO ()
-loop worker = do
+runOnce :: Core.Worker -> IO ()
+runOnce worker = do
let repo = Core.workerPath worker
AgentLog.updateActivity "Syncing tasks..."
@@ -43,12 +43,10 @@ loop worker = do
readyTasks <- TaskCore.getReadyTasks
case readyTasks of
[] -> do
- AgentLog.updateActivity "No work found, sleeping..."
- threadDelay (60 * 1000000) -- 60 seconds
- loop worker
+ AgentLog.updateActivity "No work found."
+ AgentLog.log "No ready tasks found."
(task : _) -> do
processTask worker task
- loop worker
processTask :: Core.Worker -> TaskCore.Task -> IO ()
processTask worker task = do