mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
![]() At the moment, `MyWorker.perform_in(1.month)` always schedules a job in 30 days. When added to a date, `1.month` will add 1 to the date's month count, which means that it will add 28, 29, 30, or 31 days depending on the month and year. When I call `MyWorker.perform_in(1.month)`, I would expect the job to be scheduled next month, same day of the month, all the time. At the moment, it is true only four months in the year. My pull request tries to fix this by converting the interval object to a Float at the last possible moment. Plaese note that the test I wrote will fail only during months that do not have 30 days. Ideally, I would add a dependency to Timecop and freeze time to any day in a month of 28, 29 or 31 days. This could also avoid using `#assert_in_delta`, in favour of `#assert_equal`. Feel free to read my blog post [Rails' `1.month` has a variable length](http://dstosik.github.io/rails/2015/02/19/rails-1month-variable-length/) for more details. |
||
---|---|---|
.. | ||
generators/sidekiq | ||
sidekiq | ||
sidekiq.rb |