diff options
| author | Stefan van den Oord <stefan@medicinemen.eu> | 2024-06-14 16:08:59 +0200 |
|---|---|---|
| committer | Stefan van den Oord <stefan@medicinemen.eu> | 2024-06-14 16:08:59 +0200 |
| commit | 85d13545275678a1077b9600fce136ae10dcb809 (patch) | |
| tree | 66acd3b2d5933de18945dd8d34420199bb27046e /test/com/github/ivarref/yoltq | |
| parent | Update dependency to use the new free Datomic version (diff) | |
| download | fiinha-85d13545275678a1077b9600fce136ae10dcb809.tar.gz fiinha-85d13545275678a1077b9600fce136ae10dcb809.tar.xz | |
#3 Add optional batch name to queue jobs
Diffstat (limited to 'test/com/github/ivarref/yoltq')
| -rw-r--r-- | test/com/github/ivarref/yoltq/virtual_test.clj | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/com/github/ivarref/yoltq/virtual_test.clj b/test/com/github/ivarref/yoltq/virtual_test.clj index 2800c21..7621b13 100644 --- a/test/com/github/ivarref/yoltq/virtual_test.clj +++ b/test/com/github/ivarref/yoltq/virtual_test.clj @@ -450,3 +450,25 @@ @(d/transact conn [(yq/put :q "asdf")]) (tq/consume! :q) (is (= @got-work "asdf")))) + +(deftest batch-of-jobs-test + (let [conn (u/empty-conn)] + (yq/init! {:conn conn}) + (yq/add-consumer! :q1 identity) + (yq/add-consumer! :q2 identity) + @(d/transact conn [(yq/put :q1 {:work 123} {:batch-name :b1}) + (yq/put :q1 {:work 456} {:batch-name :b2}) + (yq/put :q2 {:work 789} {:batch-name :b1})]) + (is (= [{:qname :q1 + :batch-name :b1 + :status :init + :count 1}] + (yq/batch-progress :q1 :b1))) + + (is (= {:work 123} (tq/consume! :q1))) + + (is (= [{:qname :q1 + :batch-name :b1 + :status :done + :count 1}] + (yq/batch-progress :q1 :b1))))) |
