MCPcopy
hub / github.com/triggerdotdev/trigger.dev / #detectAutoYield

Method #detectAutoYield

packages/trigger-sdk/src/io.ts:1484–1503  ·  view source on GitHub ↗
(location: string, threshold: number = 1500, task?: ServerTask, output?: string)

Source from the content-addressed store, hash-verified

1482 }
1483
1484 #detectAutoYield(location: string, threshold: number = 1500, task?: ServerTask, output?: string) {
1485 const timeRemaining = this.#getRemainingTimeInMillis();
1486
1487 if (timeRemaining && timeRemaining < threshold) {
1488 if (task) {
1489 throw new AutoYieldWithCompletedTaskExecutionError(
1490 task.id,
1491 task.outputProperties ?? [],
1492 {
1493 location,
1494 timeRemaining,
1495 timeElapsed: this.#getTimeElapsed(),
1496 },
1497 output
1498 );
1499 } else {
1500 throw new AutoYieldExecutionError(location, timeRemaining, this.#getTimeElapsed());
1501 }
1502 }
1503 }
1504
1505 #forceYield(location: string, task?: ServerTask, output?: string) {
1506 const timeRemaining = this.#getRemainingTimeInMillis();

Callers 2

runTaskMethod · 0.95
executeTaskMethod · 0.95

Calls 2

#getTimeElapsedMethod · 0.95

Tested by

no test coverage detected