-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Added timezone for cron jobs #8373
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
Added timezone for cron jobs #8373
Conversation
8c859c4 to
d76606f
Compare
Codecov Report
@@ Coverage Diff @@
## master #8373 +/- ##
==========================================
+ Coverage 33.19% 33.25% +0.05%
==========================================
Files 1220 1221 +1
Lines 13618 13636 +18
Branches 1357 1359 +2
==========================================
+ Hits 4521 4535 +14
- Misses 8212 8217 +5
+ Partials 885 884 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
d76606f to
d4aaec3
Compare
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.
LGTM but still need eng team review
|
Nice, updating the docs would also be nice :) |
|
@MattieBelt do you recommend doing this in this PR or in a separate PR? The contributing guide says documentation fixes should point to the documentation branch. Or I am taking the guide way too literally. |
|
Better to keep with the feature, so adding it in this PR would better. |
Yes, keep it with this pr, we will handle the merge of documentation. The contribution guide in that case is only for doc fixes |
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.
I think we should support object cron to be able to configure each cron as it work in the lib instead of adding global options.
|
This pull request has been mentioned on Strapi Community. There might be relevant details there: https://forum.strapi.io/t/strapi-cron-jobs-just-for-production-environment/715/2 |
9ce46c6 to
c91f5ba
Compare
@alexandrebodin changed code allows both the following snippets '*/1 * * * *': () => {
console.log('1 minute later');
},The change you're asking for probably needs a change like: '*/1 * * * *': {
task: () => {
console.log('1 minute later');
},
tz: 'Asia/Dhaka'
}I am not sure whether I have over engineered this though. @MattieBelt Added documentation |
|
Can I get a |
No need unless DigitalOcean has changed something that we are unaware of. So long as code is merged into our master branch and it doesn't have our |
|
Yes if it gets merged before 30th then it counts otherwise it doesn't. I don't wanna hurry this PR though, better if we take time and go with the best possible solution. |
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.
We could make it a be more flexible by having;
{
'* * * * *': {
task() {},
options: {
tz: '',
// other possible options
}
}
}c91f5ba to
412e389
Compare
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.
almost there ;)
Signed-off-by: Shabab Karim <shababkarim93@gmail.com>
412e389 to
75c3ff9
Compare
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.
LGTM, Refactored just a bit to make it simpler ;) Thansk for you contribution !
What does it do?
I have added cron timezone configuration on the cron initialisation hook. Strapi uses
node-scheduler, the way you add timezone with this library is mentioned here. I implemented the timezone feature in a similar mannerWhy is it needed?
As mentioned in 3099
Related issue(s)/PR(s)
None