diff options
| author | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-17 14:25:08 +0200 |
|---|---|---|
| committer | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-17 14:25:08 +0200 |
| commit | ad8a41bd7d9e6fed77f633a75ef36410b7afbef1 (patch) | |
| tree | 6ddc2760f1bb6ab3abd88cfef428a161b28da875 /src/com/github/ivarref/yoltq/virtual_queue.clj | |
| parent | Save bindings on put (diff) | |
| download | fiinha-ad8a41bd7d9e6fed77f633a75ef36410b7afbef1.tar.gz fiinha-ad8a41bd7d9e6fed77f633a75ef36410b7afbef1.tar.xz | |
Start add bindings ...
Diffstat (limited to 'src/com/github/ivarref/yoltq/virtual_queue.clj')
| -rw-r--r-- | src/com/github/ivarref/yoltq/virtual_queue.clj | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/github/ivarref/yoltq/virtual_queue.clj b/src/com/github/ivarref/yoltq/virtual_queue.clj index f133bde..71c7b6d 100644 --- a/src/com/github/ivarref/yoltq/virtual_queue.clj +++ b/src/com/github/ivarref/yoltq/virtual_queue.clj @@ -146,17 +146,18 @@ (defmacro consume-expect! [queue-name expected-status] `(if-let [job# (get-tx-q-job ~queue-name)] (try - (let [res# (some->> - (u/prepare-processing (:com.github.ivarref.yoltq/id job#) - ~queue-name - (:com.github.ivarref.yoltq/lock job#) - (:com.github.ivarref.yoltq/status job#)) - (i/take! @yq/*config*) - (i/execute! @yq/*config*))] - (test/is (= ~expected-status (:com.github.ivarref.yoltq/status res#))) - (if (:retval res#) - (:retval res#) - (:exception res#))) + (with-bindings (:com.github.ivarref.yoltq/bindings job#) + (let [res# (some->> (u/prepare-processing (d/db (:conn @yq/*config*)) + (:com.github.ivarref.yoltq/id job#) + ~queue-name + (:com.github.ivarref.yoltq/lock job#) + (:com.github.ivarref.yoltq/status job#)) + (i/take! @yq/*config*) + (i/execute! @yq/*config*))] + (test/is (= ~expected-status (:com.github.ivarref.yoltq/status res#))) + (if (:retval res#) + (:retval res#) + (:exception res#)))) (catch Throwable t# (log/error t# "unexpected error in consume-expect:" (ex-message t#)))) (test/is nil (str "No job found for queue " ~queue-name))))
\ No newline at end of file |
