untilstring[]["waiting", "succeeded", "failed", "cancelled"]Quali status termina la espera.
timeoutMsinteger600 000Dieci minuti. Passato, timeout (408) è lançat.
intervalMsinteger2 000Quante frequent i re-leads.
await run.wait();
if (run.data.status === "waiting") {
const step = run.data.steps.find((s) => s.status === "waiting");
await run.resume(step.id, { approved: true });
await run.wait(); // then on to the end
}run.wait()
if run.data["status"] == "waiting":
step = next(s for s in run.data["steps"] if s["status"] == "waiting")
run.resume(step["id"], {"approved": True})
run.wait() # then on to the endPor qu'esperare è in predefinit
Senza attendere in lista, l'attesa predefinita finirebbe sempre in un tempo di tempo di workflow con un'approvazione — e il tempo di tempo di pare un fallimento. Trattare « fermato per una persona » come un arrivo è lo che rende il default utile.
Attesa solo per il fin
await run.wait({ until: ["succeeded", "failed", "cancelled"], timeoutMs: 30 * 60_000 });run.wait(until=["succeeded", "failed", "cancelled"], timeout_ms=30 * 60_000)Ragionable quando qualcos'altro approva i passi umani. Levanta il tetto con il — una catena con una aprovação in esso può durar tanto quanto una persona toma.
Il tempo di stop non ferma la fuga
Se lance timeout (408) e la run continua. Attrapalo e reviendra tarda con getRun() — o chiama cancel() se tu volès fermar.
import { IaGenifyError } from "iagenify";
try {
await run.wait({ timeoutMs: 60_000 });
} catch (err) {
if (err instanceof IaGenifyError && err.code === "timeout") {
// Still running. Keep run.id and come back.
} else throw err;
}from iagenify import IaGenifyError
try:
run.wait(timeout_ms=60_000)
except IaGenifyError as error:
if error.code != "timeout":
raise
# Still running. Keep run.id and come back.Il pollere è liber, ma non instant
Cada tick è un let e let nul costo. Un intervale corto reagisce più veloce e fa più richieste — due secondi è il saldo ellegit.