Skip to content

Move message deletion from QueueManager into MessageWatchdog.RemoveMessages#172

Merged
stidsborg merged 1 commit into
mainfrom
queuemanager-delete-via-watchdog
Jun 20, 2026
Merged

Move message deletion from QueueManager into MessageWatchdog.RemoveMessages#172
stidsborg merged 1 commit into
mainfrom
queuemanager-delete-via-watchdog

Conversation

@stidsborg

Copy link
Copy Markdown
Owner

Summary

QueueManager no longer deletes messages via IMessageStore.DeleteMessages directly. Deletion is now owned by MessageWatchdog.RemoveMessages, which deletes the handled positions from the store and drops them from its ignore-set in one step.

What changed

  • IMessageWatchdog.RemoveMessages — now Task RemoveMessages(StoredId storedId, IReadOnlyList<long> positions) (gained the StoredId, became async).
  • MessageWatchdog.RemoveMessages — deletes from _messageStore first, then trims _pushedPositions. Delete-before-trim preserves the existing ordering so a no-longer-ignored position can't be re-fetched before it's gone from the store.
  • QueueManager — the three delete sites (Initialize replay, idempotency-duplicate, AfterFlush) collapse from a DeleteMessages + RemoveMessages pair to a single await _messageWatchdog.RemoveMessages(_storedId, …). _messageStore is still used for GetMessages (fetch), just no longer for deletes.
  • Tests — the hand-rolled QueueManager tests keep a one-line no-op stub (now async, matching the new signature).

Testing

  • Full solution builds clean (0 warnings / 0 errors).
  • Full in-memory suite passes (518 tests), including idempotency-dedup and remove-after-completion messaging cases.

…ssages

QueueManager no longer calls IMessageStore.DeleteMessages directly. Instead
RemoveMessages now owns deletion: it deletes the handled positions from the
store and then trims them from the watchdog's ignore-set (delete-before-trim so
a no-longer-ignored position can't be re-fetched before it is gone from the
store). The three QueueManager delete sites (Initialize replay, idempotency
duplicate, AfterFlush) collapse to a single awaited RemoveMessages call.

IMessageWatchdog.RemoveMessages gains the StoredId and becomes async; the
hand-rolled QueueManager tests keep a one-line no-op stub.
@stidsborg stidsborg merged commit a82290a into main Jun 20, 2026
8 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