(defn
process-messages
[]
(set! running? true)
(set! queued? false)
(loop
[count 0]
(let
[m (.pop tasks)]
(when-not
(nil? m)
(m)
(when (< count TASK_BATCH_SIZE) (recur (inc count))))))
(set! running? false)
(when (> (.-length tasks) 0) (queue-dispatcher)))