Skip to content

Commit

Permalink
removed redundant when
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Feb 22, 2024
1 parent 46f1540 commit 4c85cf9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions IHP/Job/Queue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4c85cf9

Please sign in to comment.