getNextRun() — supabase Function Reference
Architecture documentation for the getNextRun() function in CronJobTableCell.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 844d6d9a_04b6_008d_38b6_f6c6fbd1ae39["getNextRun()"] f052eb8c_ed4d_9c25_0240_3604a8976c21["CronJobTableCell()"] f052eb8c_ed4d_9c25_0240_3604a8976c21 -->|calls| 844d6d9a_04b6_008d_38b6_f6c6fbd1ae39 style 844d6d9a_04b6_008d_38b6_f6c6fbd1ae39 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/Integrations/CronJobs/CronJobTableCell.tsx lines 46–72
const getNextRun = (schedule: string, lastRun?: string) => {
// cron-parser can only deal with the traditional cron syntax but technically users can also
// use strings like "30 seconds" now, For the latter case, we try our best to parse the next run
// (can't guarantee as scope is quite big)
if (schedule.includes('*')) {
try {
const interval = parser.parseExpression(schedule, { tz: 'UTC' })
return interval.next().getTime()
} catch (error) {
return undefined
}
} else {
// [Joshen] Only going to attempt to parse if the schedule is as simple as "n second" or "n seconds"
// Returned undefined otherwise - we can revisit this perhaps if we get feedback about this
const [value, unit] = schedule.toLocaleLowerCase().split(' ')
if (
['second', 'seconds'].includes(unit) &&
!Number.isNaN(Number(value)) &&
lastRun !== undefined
) {
const parsedLastRun = dayjs(lastRun).add(Number(value), unit as dayjs.ManipulateType)
return parsedLastRun.valueOf()
} else {
return undefined
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getNextRun() do?
getNextRun() is a function in the supabase codebase.
What calls getNextRun()?
getNextRun() is called by 1 function(s): CronJobTableCell.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free