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

Can I use time_limit in send_with_options/message_with_options? #44

fizz opened this issue Mar 29, 2018 · 1 comment

Can I use time_limit in send_with_options/message_with_options? #44

fizz opened this issue Mar 29, 2018 · 1 comment


Copy link

@fizz fizz commented Mar 29, 2018

Use case: I have an actor that sometimes takes longer than 10 minutes to run. I can predict this. Let's say I want to double the default time_limit. If I use the decorator @actor(time_limit=1_200_000) then the actor will always have the 20-minute time_limit. I only want to increase the time_limit when I know I'm handing the actor a larger amount of work. Usually, I want it to have the default time_limit.

quirky_actor.message_with_options(args=(config.get('whats_my_motivation'),), time_limit=1_000*60*20)

I'm having a hard time figuring out if this even works. Should it work?

@Bogdanp Bogdanp self-assigned this Mar 29, 2018
@Bogdanp Bogdanp added the bug label Mar 29, 2018
Copy link

@Bogdanp Bogdanp commented Mar 29, 2018

That should work, but currently doesn't because the TimeLimit middleware only looks at actor options right now.

This line:

Should be:

limit = message.options.get("time_limit") or actor.options.get("time_limit", self.time_limit))

I'll put out a fix this weekend. Thanks for the report!

@Bogdanp Bogdanp closed this in 3c8b214 Mar 31, 2018
MihaiBalint added a commit to MihaiBalint/dramatiq that referenced this issue Feb 21, 2019
Bogdanp added a commit that referenced this issue Feb 23, 2019
This is similar to #44.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.