mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-28 00:02:42 +00:00
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
19 lines
702 B
TypeScript
19 lines
702 B
TypeScript
import type { Job } from '$lib/gen'
|
|
|
|
/**
|
|
* A successful, non-scheduled, top-level script can have neither retry attempts
|
|
* (retries only spawn after a failure, so the first attempt would not be
|
|
* `success`) nor schedule handlers (they only fire for schedule triggers, i.e.
|
|
* when `schedule_path` is set). Its child-job (`parent_job = ?`) query would
|
|
* always come back empty, so it can be skipped — this runs on every script run
|
|
* view, so avoiding the round-trip on the common success path matters.
|
|
*/
|
|
export function canSkipRetryChainQuery(job: Job): boolean {
|
|
return (
|
|
job.type === 'CompletedJob' &&
|
|
job.parent_job == null &&
|
|
job.success === true &&
|
|
job.schedule_path == null
|
|
)
|
|
}
|