From 4c85cf9fae824d085f94b544eac66a6cb1160d87 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Thu, 22 Feb 2024 10:17:13 +0100 Subject: [PATCH] removed redundant when --- IHP/Job/Queue.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/IHP/Job/Queue.hs b/IHP/Job/Queue.hs index 9d9477fdc..88c7fae40 100644 --- a/IHP/Job/Queue.hs +++ b/IHP/Job/Queue.hs @@ -94,12 +94,11 @@ pollForJob tableName pollInterval onNewJob = do forever do count :: Int <- sqlQueryScalar query params - when (count > 0) do - -- For every job we send one signal to the job workers - -- This way we use full concurrency when we find multiple jobs - -- that haven't been picked up by the PGListener - forEach [1..count] \_ -> do - Concurrent.putMVar onNewJob JobAvailable + -- For every job we send one signal to the job workers + -- This way we use full concurrency when we find multiple jobs + -- that haven't been picked up by the PGListener + forEach [1..count] \_ -> do + Concurrent.putMVar onNewJob JobAvailable -- Add up to 2 seconds of jitter to avoid all job queues polling at the same time jitter <- Random.randomRIO (0, 2000000)