get_result() always returns an error if timeout < 1000 #648
Open
Description
Issues
I believe we are doing integer division which is why we can only specify multiples of full seconds.
In that way defining a timeout parameter as milliseconds integer is very confusing.
I think this is where we are doing an integer division by mistake:
Proposed solutions
Use datetime.timedelta type for the timeout, use datetime.datetime type (datetime.now() ) for end_time calculation.
If you want I could raise a PR with the respective changes.
Checklist
- Does your title concisely summarize the problem?
- Did you include a minimal, reproducible example?
- What OS are you using?
- What version of Dramatiq are you using?
- What did you do?
- What did you expect would happen?
- What happened?
What OS are you using?
Manjaro Linux and MacOS
What version of Dramatiq are you using?
1.17.0
What did you do?
This does not work:
message_1.get_result(block=True, timeout=100)
This does work:
message_1.get_result(block=True, timeout=1000)
What did you expect would happen?
I expect it to also work with values < 1000
What happened?
It always returns an error.
Metadata
Assignees
Labels
No labels