Skip to content

Commit

Permalink
Change default cron schedule to standard cron syntax.
Browse files Browse the repository at this point in the history
Resolves #357
  • Loading branch information
claabs committed Jul 9, 2023
1 parent 6d621c0 commit c048289
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The config file is stored in the mounted `/usr/app/config` volume and can be nam
```jsonc
{
"runOnStartup": true,
"cronSchedule": "0 0/6 * * *",
"cronSchedule": "0 0,6,12,18 * * *",
"logLevel": "info",
"webPortalConfig": {
"baseUrl": "https://epic.example.com",
Expand Down
2 changes: 1 addition & 1 deletion examples/deployment.k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data:
account1: |
{
"runOnStartup": true,
"cronSchedule": "0 0/6 * * *",
"cronSchedule": "0 0,6,12,18 * * *",
"logLevel": "info",
"webPortalConfig": {
"baseUrl": "https://epic.example.com",
Expand Down
6 changes: 3 additions & 3 deletions src/common/config/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ export enum LogLevel {
* @example ```jsonc
* {
* "runOnStartup": true,
* "cronSchedule": "0 0/6 * * *",
* "cronSchedule": "0 0,6,12,18 * * *",
* "logLevel": "info",
* "webPortalConfig": {
* "baseUrl": "https://epic.example.com",
Expand Down Expand Up @@ -675,12 +675,12 @@ export class AppConfig {
* **It is recommended to run every 6 hours, otherwise the refresh tokens will expire after 8 hours and a new login will be prompted every run.**
* If you want the check to occur immediately after the new free game is released, you can offset the cron schedule. For example in a timezone where the free games release at 11:00am: `0 5,11,17,23 * * *`
* @example 0 5,11,17,23 * * *
* @default 0 0/6 * * * (every six hours)
* @default 0 0,6,12,18 * * * (every six hours)
* @env CRON_SCHEDULE
*/
@IsOptional()
@IsString()
cronSchedule = process.env.CRON_SCHEDULE || '0 */6 * * *';
cronSchedule = process.env.CRON_SCHEDULE || '0 0,6,12,18 * * *';

/**
* The search criteria for finding free games. Either the weekly promotion, and free promotion, or all free products.
Expand Down
2 changes: 1 addition & 1 deletion src/common/config/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const cronIntervalMs = nextDate.getTime() - prevDate.getTime();
const intervalMinimumMs = 7 * 60 * 60 * 1000; // 7 hours
if (cronIntervalMs > intervalMinimumMs) {
L.warn(
{ yourCronSchedule: cronSchedule, everySixCronSchedule: '0 0/6 * * *' },
{ yourCronSchedule: cronSchedule, everySixCronSchedule: '0 0,6,12,18 * * *' },
'Your cronSchedule configuration is not set to run often enough to ensure the device auth refresh token can stay valid. This can result in device auth login prompts being sent on every run. It is recommended to set the cron schedule to run every 6 hours.'
);
}
Expand Down

0 comments on commit c048289

Please sign in to comment.