Closed emmiegit closed 7 months ago
Hi! You are right that it doesn't look right.
After checking the code a bit I changed it to be seconds rather than millis. I published a version 7 of the crate and added a test for the delays. It should work as expected now.
The numer_in_range
function comes from the internal check the js counterpart of this library did. Do it is more for compatibility with it. In the future I might try to extend that.
In any case, now the number is not multiplied, so you have a max delay of 115 days.
Thanks for the response! I've tested the new version, and it looks like it works fine with 1 day-jobs. I think the only remaining item in this issue is my suggestion to document the maximum values in the crate docs, other than that I believe the core question raised in this issue is resolved.
After some thinking I changed the variables to use the std::time::Duration
and be stored in milliseconds rather than seconds in Redis.
Please, test that it works with the 1 day jobs you are planning to use.
Also, please, keep in mind that this is a breaking change (published under version 8, following SemVer), so make sure that there are no messages when you deploy the new version. You can use another queue prefix if you want to keep running both version during some time.
Thank you for the notice! I appreciate the Duration
change, it makes it easier for API users to be certain about the duration they're requesting since it is not unitless.
Hello, I've been using
rsmq-async
to implement a job queue, and for one of my use cases I want to run a job after one day. However it seems this surpasses the limitdelay
values can have, and I'm not sure I understand why.The error reported is that
86400000 > 9999999
, which was confusing to me since I was entering86400
, which is well below9999999
. Looking atsend_message
in the Rust docs makes no mention of a maximum value fordelay
, other than the implicit maximum value for au64
.When I opened the code and began reading through, I see that within
send_message
the delay value is first multipled by1000
, and then it is compared against9_999_999
.Given this, a few questions:
receive_message
, the maximumseconds_hidden
value is instead9_999_999_000
.numer_in_range()
checks are not documented?Thank you in advance.