aboutsummaryrefslogtreecommitdiff
path: root/src/com/github/ivarref/yoltq/impl.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/github/ivarref/yoltq/impl.clj')
-rw-r--r--src/com/github/ivarref/yoltq/impl.clj11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/github/ivarref/yoltq/impl.clj b/src/com/github/ivarref/yoltq/impl.clj
index adc169d..50441ff 100644
--- a/src/com/github/ivarref/yoltq/impl.clj
+++ b/src/com/github/ivarref/yoltq/impl.clj
@@ -37,8 +37,9 @@
queue-name
payload
opts]
- (if-let [_ (get-in config [:handlers queue-name])]
+ (if-let [q-config (get-in config [:handlers queue-name])]
(let [id (u/squuid)
+ depends-on (get q-config :depends-on (fn [_] nil))
str-bindings (->> (reduce (fn [o k]
(assoc o (symbol k) (deref k)))
{}
@@ -51,11 +52,15 @@
:com.github.ivarref.yoltq/status u/status-init
:com.github.ivarref.yoltq/payload (pr-str-safe :payload payload)
:com.github.ivarref.yoltq/bindings str-bindings
- :com.github.ivarref.yoltq/opts (pr-str-safe :opts (or opts {}))
+ :com.github.ivarref.yoltq/opts (pr-str-safe :opts
+ (merge
+ (when-let [deps (depends-on payload)]
+ {:depends-on deps})
+ (or opts {})))
:com.github.ivarref.yoltq/lock (u/random-uuid)
:com.github.ivarref.yoltq/tries 0
:com.github.ivarref.yoltq/init-time (u/now-ns)}
- (when-let [[q ext-id] (:depends-on opts)]
+ (when-let [[q ext-id] (or (:depends-on opts) (depends-on payload))]
(when-not (d/q '[:find ?e .
:in $ ?ext-id
:where