-
Notifications
You must be signed in to change notification settings - Fork 52
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 an ability to customize task options (and data) when calling tube:release() #125
Comments
What do you think about implementing the task "options" update in a separate method like |
@LeonidVas Could you elaborate on how you see it, what options will it support? Maybe you have some examples on hand? |
Respond to question with counter-questions - not bad)(Вы, таки, не с Одессы будете?)
For ascertaining the answers, I should to look around and see how this works in other similar software, and when I asked you a question, I thought you have some knowledge in this area and you would like to share it. |
OK, let me explain then why I asked you about giving more details :) When you proposed the new api method, I thought you had already thought about how it would work and what it should accept. For example, will it be able to increment, decrement, or reset tasks t:options(task_id, {ttr_inc=60}) Will it allow to change the task state: t:options(task_id, {state=state.READY}) or/and delay: t:options(task_id, {delay=42}) If so, what do you plan to do with the existing functions that already have this functionality? Deprecate them or keep them? See, there are tons of questions and just throwing random ideas without specifying exactly what you meant doesn't help, no one can read your mind. Without knowing these details, I can't give any meaningful answer. But if you're expecting a super generic answer: no, I don't really like it, and I don't remember seeing anything like that in any other related product. At a glance, it feels too low-level end error-prone, because you can't make those option arguments part of the interface (if this term can be applied to lua :)). Also, I don't know what problem you are trying to solve by introducing a new function. If it's about keeping |
Thanks for that! (I wish you did it from the beginning :))
Neither do I. Please see my thoughts below.
Good point. And I don't have a clear answer for that. It could depend on how we treat these input parameters. Of course, if they were "domain" parameters like
From the usability perspective, if I had to choose between t:touch(task_id, 60); and t:options(task_id, {ttl={'+', 60}}) I would choose the former just because it reads better and I don't have to check the option name and how to increment its value in the docs. On the other hand, having the ability to modify multiple options at once could be useful when used from synchronous connectors (see #124). FTR, If you decide to go with the t:release(task_id)
t:options(task_id, {ttr={'+', 60}, prio={'+', 1}, meta={ retry={'+', 1} }}) which means that I have to extend this library by adding my own Lua function that wraps these calls. This completely defeats the purpose of this ticket, as I already have such a wrapper that I would like to get rid of. After all, I'm more in favor of extending |
tube:release() accepts an optional second argument
opts
, which at this moment can only consist ofdelay
. But often when I release a task back into the queue, I need to adjust other task options, such as priority or ttl. Also, in task data I usually store additional options such as retry strategy, retry count, etc, and it would be great if I can adjust them as well when callingtube:release()
(or even better, add an extra field calledextra
ormeta
where users can store custom task options?).The text was updated successfully, but these errors were encountered: