Changed the minimum interval time period from 60s to 20s (with changeset)

This commit is contained in:
Matt Aitken
2024-01-21 17:06:09 +00:00
parent dcf95c4eb2
commit 583da458ec
4 changed files with 10 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/core": patch
---
Changed the minimum interval time period from 60s to 20s
@@ -103,11 +103,11 @@ function validateSchedule(schedule: ScheduleMetadata): ScheduleMetadata {
} }
function validateInterval(schedule: IntervalMetadata): ScheduleMetadata { function validateInterval(schedule: IntervalMetadata): ScheduleMetadata {
if (schedule.options.seconds < 60) { if (schedule.options.seconds < 20) {
return { return {
type: "interval", type: "interval",
options: { options: {
seconds: 60, seconds: 20,
}, },
}; };
} }
+1 -1
View File
@@ -12,7 +12,7 @@ description: "`intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigg
Intervals are set with a number of seconds. There are some important considerations: Intervals are set with a number of seconds. There are some important considerations:
- The Job will first run the specified number of seconds after it has first connected to an [Environment](/documentation/concepts/environments-endpoints). This will happen when you first [deploy](/documentation/guides/deployment) that Job. - The Job will first run the specified number of seconds after it has first connected to an [Environment](/documentation/concepts/environments-endpoints). This will happen when you first [deploy](/documentation/guides/deployment) that Job.
- The minimum interval is 60 seconds (any input less than this it will default to 60). - The minimum interval is 20 seconds (any input less than this it will default to 20).
- The maximum interval is 2_592_000 seconds (30 days), if you pass more than this it will trigger every 30 days. - The maximum interval is 2_592_000 seconds (30 days), if you pass more than this it will trigger every 30 days.
If you wish to Run a Job at an exact time or less frequently than once pr day you should use a [cronTrigger()](/sdk/crontrigger) instead. If you wish to Run a Job at an exact time or less frequently than once pr day you should use a [cronTrigger()](/sdk/crontrigger) instead.
+2 -2
View File
@@ -10,8 +10,8 @@ export const ScheduledPayloadSchema = z.object({
export type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>; export type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
export const IntervalOptionsSchema = z.object({ export const IntervalOptionsSchema = z.object({
/** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */ /** The number of seconds for the interval. Min = 20, Max = 2_592_000 (30 days) */
seconds: z.number().int().positive().min(60).max(2_592_000), seconds: z.number().int().positive().min(20).max(2_592_000),
}); });
/** Interval options */ /** Interval options */