-
-
Notifications
You must be signed in to change notification settings - Fork 709
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
add UniqueKey option to extend Unique's behaviour #407
Conversation
Instead of (queue, type, payload) use any custom key. This allows to enforce unique tasks not limited to same payload and/or type.
@benjajaja Thanks for opening a pull request! If you are able to generate a unique key, then the |
@hibiken So that's my use case: I want some retention, so that I can query the task for a bit after completion, but I also want to use uniqueness options. |
I see. So I'm guessing you want to use this |
@hibiken right now I'm using the |
BTW I started by trying to add a "key" option to |
Presumably you want to generate a For example, if you want to use a unique_key of (user_id) and TTL of 1 hour then you could generate a unique task ID in a format This way, all tasks fall under the same time window will be deduplicated, but a task in the next time window won't be blocked by the previous task even if that previous task is still in the queue as a completed task (actually it doesn't matter which state the previous task is in). |
No, I do want retention, so that I can call
A time window is interesting, but I am not bound by any time windows. It would also allow for duplicate tasks, if the tasks run longer than the window. Thank you for coming up with this, but it won't really fit my case. BTW, as I said I am using unique task-ids so far and it works, it's just that I can't retain them for more than some seconds, as that block newer tasks. It's not a big deal, but it would be nice to retain them longer, to do some more analysis. |
I see. Thank you for providing more details. I've seen similar feedback/discussion around It seems that we need to allow user to specify:
in addition to the TTL value. |
Ok, thanks! I'll keep an eye on it. |
Instead of (queue, type, payload) use any custom key. This allows to
enforce unique tasks not limited to same payload and/or type.
Tested with
--redis_cluster
flag.