aboutsummaryrefslogtreecommitdiff
path: root/src/com/github/ivarref/yoltq/poller.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/github/ivarref/yoltq/poller.clj')
-rw-r--r--src/com/github/ivarref/yoltq/poller.clj12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/github/ivarref/yoltq/poller.clj b/src/com/github/ivarref/yoltq/poller.clj
index ad9d32a..1f4e65d 100644
--- a/src/com/github/ivarref/yoltq/poller.clj
+++ b/src/com/github/ivarref/yoltq/poller.clj
@@ -5,10 +5,14 @@
(defn poll-once! [cfg q status]
- (case status
- :init (some->> (u/get-init cfg q) (i/take! cfg) (i/execute! cfg))
- :error (some->> (u/get-error cfg q) (i/take! cfg) (i/execute! cfg))
- :hung (some->> (u/get-hung cfg q) (i/take! cfg) (i/execute! cfg))))
+ (when-let [item (case status
+ :init (u/get-init cfg q)
+ :error (u/get-error cfg q)
+ :hung (u/get-hung cfg q))]
+ (with-bindings (get item :bindings {})
+ (some->> item
+ (i/take! cfg)
+ (i/execute! cfg)))))
(defn poll-queue! [running?