Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support redis max_receives config option #100

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

jaymell
Copy link
Contributor

@jaymell jaymell commented Aug 30, 2024

This adds a max_receives option to both Redis queue implementations.
This is the first step in supporting deadletter queuing.

InternalPayload type aliases have been added to represent Omniqueue
items that track the current number of times a message has been
received (num_receives). num_receives is incremented whenever
an item is re-queued from the pending/processing queues until it
hits max_receives, at which point the message is abandoned. Later
we will support putting this in an optional deadletter queue.

I originally tried adding a proper struct for InternalPayload, but
I don't think that clarified anything and was less memory optimal,
so the relevant logic has been captured in simple functions/macro
instead.

@jaymell jaymell force-pushed the james/redis-max-attempts-functions branch 2 times, most recently from 5d6fcc6 to 4c01ad0 Compare August 30, 2024 18:17
@jaymell jaymell marked this pull request as ready for review August 30, 2024 18:27
@jaymell jaymell requested a review from a team as a code owner August 30, 2024 18:27
@jaymell jaymell force-pushed the james/redis-max-attempts-functions branch 3 times, most recently from ba3f9e2 to d833b06 Compare August 30, 2024 19:56
This adds a `max_receives` option to both Redis queue implementations.
This is the first step in supporting deadletter queuing.

`InternalPayload` type aliases have been added to represent Omniqueue
items that track the current number of times a message has been
received (`num_receives`). `num_receives` is incremented whenever
an item is re-queued from the pending/processing queues until it
hits `max_receives`, at which point the message is abandoned. Later
we will support putting this in an optional deadletter queue.

I originally tried adding a proper struct for `InternalPayload`, but
I don't think that clarified anything and was less memory optimal,
so the relevant logic has been captured in simple functions/ a macro
instead.
@jaymell jaymell force-pushed the james/redis-max-attempts-functions branch from d833b06 to a49ab47 Compare August 30, 2024 20:04
omniqueue/src/backends/redis/fallback.rs Outdated Show resolved Hide resolved
omniqueue/src/backends/redis/mod.rs Outdated Show resolved Hide resolved
omniqueue/src/backends/redis/streams.rs Outdated Show resolved Hide resolved
@jaymell jaymell force-pushed the james/redis-max-attempts-functions branch from 90b5b12 to 0345177 Compare September 3, 2024 16:14
Also address other review comments
@jaymell jaymell force-pushed the james/redis-max-attempts-functions branch from 0345177 to d6f3741 Compare September 3, 2024 16:16
@svix-james svix-james merged commit 72604d0 into svix:main Sep 3, 2024
4 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.

3 participants