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

Fix cache warming schedule again #2508

Merged
merged 1 commit into from
May 11, 2021
Merged

Fix cache warming schedule again #2508

merged 1 commit into from
May 11, 2021

Conversation

sihugh
Copy link
Contributor

@sihugh sihugh commented May 11, 2021

It turns out that Whenever does something weird when you provide a minutes argument that is less than or equal to 30. It assumes you mean 'every n minutes' whereas for values greater than 30, it assumes you mean 'the nth minute'.

Whenever specs describing the behaviour

So, when the random number generates an 8, whenever generates a schedule like this (edited for brevity):

8,16,24,32,40,48,56 * * * * /bin/bash -l -c 'rake registries:cache_refresh'

We'll switch to using raw cron syntax instead. From the Readme:

every '0 0 27-31 * *' do
command "echo 'you can use raw cron syntax too'"
end

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

It turns out that Whenever does something weird when you provide a minutes
argument that is less than or equal to 30. It assumes you mean 'every n minutes'
whereas for values greater than 30, if assumes you mean 'the nth minute'.

[Whenever specs describing the behaviour](https://github.com/javan/whenever/blob/e916b58f29ea4da76de9ddc5aca8c85a5f29f897/test/unit/cron_test.rb#L17-L19)

So, when the random number generates an 8, whenever generates a schedule like
this (edited for brevity):

> 8,16,24,32,40,48,56 * * * * /bin/bash -l -c 'rake registries:cache_refresh'

We'll switch to using raw cron syntax instead. [From the Readme](https://github.com/javan/whenever/blob/e916b58f29ea4da76de9ddc5aca8c85a5f29f897/README.md):

> every '0 0 27-31 * *' do
>  command "echo 'you can use raw cron syntax too'"
> end
@bevanloon bevanloon temporarily deployed to finder-front-whenever-3hvshjwc May 11, 2021 15:53 Inactive
Copy link
Contributor

@bilbof bilbof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So good 👍

@sihugh sihugh merged commit 9718df5 into main May 11, 2021
@sihugh sihugh deleted the whenever branch May 11, 2021 16:03
Copy link
Contributor

@hannako hannako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯

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

Successfully merging this pull request may close these issues.

4 participants