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

get_result() always returns an error if timeout < 1000 #648

Open
7 tasks done
JanBeelte opened this issue Sep 4, 2024 · 0 comments
Open
7 tasks done

get_result() always returns an error if timeout < 1000 #648

JanBeelte opened this issue Sep 4, 2024 · 0 comments

Comments

@JanBeelte
Copy link

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:
image

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.

@JanBeelte JanBeelte changed the title get_result() always return an error if timeout < 1000 get_result() always returns an error if timeout < 1000 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant