noConvexTopOfHourCrons (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noConvexTopOfHourCrons - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- This rule belongs to the following domains:
- Sources:
- Same as
@convex-dev/no-top-of-hour-crons
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noConvexTopOfHourCrons": "error" } } }}Description
Section titled “Description”Disallow scheduling Convex cron jobs at the start of the hour.
Many apps receive the most traffic, webhooks, and scheduled work right at the start of
the hour (minute :00). A cron job that runs at that time competes with this peak, so
it’s more likely to hit your app’s limits.
When you leave out minuteUTC, Convex picks a minute for you and spreads the runs
across the hour. You can also choose a specific minute other than 0 when the job needs
to run at a predictable time.
This rule reports:
- calls to
hourly(),daily(),weekly(), andmonthly()whose schedule setsminuteUTCto0; - calls to
cron()whose cron expression runs at minute0, for example"0 3 * * *","0,30 * * * *", or"0-5 * * * *".
Examples
Section titled “Examples”Invalid
Section titled “Invalid”crons.hourly("cleanup", { minuteUTC: 0 }, internal.tasks.cleanup);code-block.js:1:27 lint/nursery/noConvexTopOfHourCrons ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This cron job runs at the start of the hour.
> 1 │ crons.hourly("cleanup", { minuteUTC: 0 }, internal.tasks.cleanup);
│ ^^^^^^^^^^^^
2 │
ℹ Many apps receive the most traffic and scheduled work at minute :00, so a job that runs at that time is more likely to hit your app's limits.
ℹ Remove minuteUTC to let Convex pick a minute and spread the runs across the hour, or set it to a minute other than 0.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
crons.daily("report", { hourUTC: 9, minuteUTC: 0 }, internal.tasks.report);code-block.js:1:37 lint/nursery/noConvexTopOfHourCrons ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This cron job runs at the start of the hour.
> 1 │ crons.daily("report", { hourUTC: 9, minuteUTC: 0 }, internal.tasks.report);
│ ^^^^^^^^^^^^
2 │
ℹ Many apps receive the most traffic and scheduled work at minute :00, so a job that runs at that time is more likely to hit your app's limits.
ℹ Remove minuteUTC to let Convex pick a minute and spread the runs across the hour, or set it to a minute other than 0.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
crons.cron("nightly", "0 3 * * *", internal.tasks.nightly);code-block.js:1:23 lint/nursery/noConvexTopOfHourCrons ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This cron job runs at the start of the hour.
> 1 │ crons.cron("nightly", "0 3 * * *", internal.tasks.nightly);
│ ^^^^^^^^^^^
2 │
ℹ Many apps receive the most traffic and scheduled work at minute :00, so a job that runs at that time is more likely to hit your app's limits.
ℹ Use hourly() or daily() without minuteUTC to let Convex pick a minute, use interval() if the job doesn't need to follow the clock, or use a minute other than 0 in the cron expression.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
crons.hourly("cleanup", internal.tasks.cleanup);crons.daily("nightly", { hourUTC: 3 }, internal.tasks.nightly);crons.hourly("cleanup", { minuteUTC: 37 }, internal.tasks.cleanup);crons.cron("nightly", "17 3 * * *", internal.tasks.nightly);crons.interval("sync", { minutes: 15 }, internal.tasks.sync);Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.