-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
FeatReq: Support timedelta for delays? #522
Comments
I like it. Since you've already written the code, how about opening a PR for it? (and maybe a test or two) Looks like the maintainer already has his hands full... |
I think this is a good idea and a PR would be appreciated. |
Hi, @h3nnn4n, I noticed, that the changes are not consistent with other parts of the project which also accept delays in milliseconds. timedelta should also be acceptable as:
These are some places that come to my mind, there are probably more of them. Otherwise, thanks for the PR! |
I think the request here has been covered so I'm going to close this for now. If someone wants to extend the other places where we could use timedeltas, feel free to open a PR. |
In GoLang they have a Duration class that is actually pretty nifty. Instead of passing a int of seconds to sleep, you pass a Duration. Python's similar timedelta class doesn't get much love, but I enjoy using it in place of ints for time within my own code a lot. I notice in Dramatiq, the code wants timeouts and delays passed as millis, which makes sense, but isn't intuitive perhaps from the hinting. So I was wondering if Dramatiq could also accept timedeltas and use those, as there's no ambiguity in them. (While still treating ints as millis for backwards compatibility.)
It'd look something like this:
And within the code it's just:
Funding
The text was updated successfully, but these errors were encountered: