-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve enqueued_job at specs and warn about precision. #2350
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JonRowe
force-pushed
the
improve-enqueued-job-at
branch
from
May 28, 2020 09:46
2fc5707
to
a815b2e
Compare
benoittgt
approved these changes
May 28, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. I hit this issue many times before. This warning will help lot's people to understand spec failure in this case. 🙏
JonRowe
force-pushed
the
improve-enqueued-job-at
branch
from
May 28, 2020 11:14
a815b2e
to
f9c3bc1
Compare
JonRowe
added a commit
that referenced
this pull request
Jun 10, 2020
JonRowe
added a commit
that referenced
this pull request
Jun 10, 2020
JonRowe
added a commit
that referenced
this pull request
Jun 10, 2020
This was referenced Mar 7, 2021
This was referenced Mar 15, 2021
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an issue with our time matching for
enqueued_job
, Rails allows microsecond (usec) precision in job queue values, and uses.to_f
for exact time scheduling, which we replicated in #2157, without thisto_f
you cannot check exact time scheduled jobs.However when Rails schedules a job in the future using
wait: n
it is doingn.seconds.from_now
which does not get passed throughto_f
, there is no way for us to detect which is correct so we'll stick with out existing handling, but warn about this precision issue, addingchange(usec: 0)
or switching ton.seconds.from_now
...Ironically I found this by trying to remove
freeze_time
from our own specs, it appears thattravel_to
specific time, keepsusec
precision, but notfreeze_time
?