Skip to content

feat: Reject for varmq IAcknowledgeable - #21

Merged
fahimfaisaal merged 1 commit into
mainfrom
feat/reject
Nov 6, 2026
Merged

fahimfaisaal merged 1 commit into
mainfrom
feat/reject

Conversation

@fahimfaisaal

Copy link
Copy Markdown
Member

Summary

Reject(ackID, reason) on Queue and PriorityQueue, so sqliteq satisfies varmq's IAcknowledgeable (goptics/varmq#173: failed jobs call Reject, not Acknowledge).

 Acknowledge(ackID)    -> finish(ackID, q.ack)
+Reject(ackID, reason) -> finish(ackID, q.reject)
   removeOnComplete (default)  -> DELETE row        # same as ack
   WithRemoveOnComplete(false) -> status 'failed'   # ack keeps 'completed'
  • One finish path for both: same ack-ID parse, group commit, one prepared statement each.
  • reason not stored: would need a schema migration.
  • A kept failed row still blocks EnqueueOnce of the same ID, like a completed row.

Evidence

  • reject_test.go:
    • reject deletes the row; the restart requeue sweep does not bring it back; second finish and a bad ack ID fail
    • WithRemoveOnComplete(false): one completed + one failed row, neither requeued
    • priority queue rejects
  • go test -race ./... passes, 91.3% coverage; Reject, Acknowledge at 100%.
  • varmq examples/sqlite-persistent vets against this branch.

Merge Danger

Door: two-way

New method only; Acknowledge behavior unchanged.

Blast Radius: sqliteq API

  • Failed jobs kept with WithRemoveOnComplete(false) now read failed, not completed; anything counting completed rows sees fewer.

Reject(ackID, reason) finishes a processing item that failed for good:
deleted like an ack, or with WithRemoveOnComplete(false) kept with
status 'failed'. Same group commit as Acknowledge via a shared finish.
Reason is not stored (no column). Required since varmq#173.
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
queue.go 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fahimfaisaal
fahimfaisaal merged commit 5a2cbbb into main Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant