src/clj_commons/durable_queue.clj:in-progress (AtomicLong. 0) to the mapsrc/clj_commons/durable_queue.cljcnt variable (.size q call):in-progress from parameters (it will now be used):in-progress value from formula to (.get ^AtomicLong in-progress)src/clj_commons/durable_queue.clj:in-progress from stats(.decrementAndGet in-progress-counter) after incrementing completedsrc/clj_commons/durable_queue.clj:in-progress from stats(.decrementAndGet in-progress-counter) after incrementing retriedsrc/clj_commons/durable_queue.clj(status! t :in-progress) add:
(populate-stats! q-name)
(let [^AtomicLong counter (get-in @queue-name->stats [q-name :in-progress])]
(.incrementAndGet counter))
test/clj_commons/durable_queue_test.cljtest-in-progress-starts-at-zero: After creating queue, in-progress should be 0test-in-progress-increments-on-take: After take!, in-progress should be 1test-in-progress-decrements-on-complete: After mark-complete!, in-progress should be 0test-in-progress-decrements-on-retry: After mark-retry!, in-progress should be 0test-in-progress-multiple-items: After multiple take!s, in-progress should equal number takentest-in-progress-never-negative: Verify in-progress >= 0 in all scenariostest/clj_commons/durable_queue_test.cljtest-in-progress-thread-safeclj -M:test or bb testclj -M:test durable_queue_test/test-in-progress* (or equivalent)Check: Does initial-stats create all 4 counters?
Fix: Ensure :in-progress (AtomicLong. 0) is in the returned map
Check: Does immediate-stats receive :in-progress parameter?
Fix: Ensure destructuring includes in-progress in function signature
Check: Are stats being populated before accessing?
Fix: Ensure (populate-stats! q-name) is called before accessing counter
Check: Are all decrement points implemented (mark-complete! and mark-retry!)? Fix: Verify mark-retry! decrements the counter
Check: Is take! incrementing the counter? Fix: Verify increment code is in the success path (inside the if-let)
Check: Is there a deadlock in stats access? Fix: Verify no circular locking or long-held locks
After completing all items:
Estimated Time: 2-4 hours for experienced developer Risk Level: Low (isolated to stats tracking, no behavior changes) Rollback Plan: Revert 5 edits; existing behavior restored
Reviewer should verify:
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |