Queue
Background task processing with status tracking.
client.queue.submit()
Submit a task to the background queue.
const { } = await ..({
: "process-image",
: { : "https://example.com/image.png" },
});client.queue.status()
Get the current status of a task.
const = await ..({ });
// task.status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'| Status | Description |
|---|---|
pending | Queued, not started |
running | Currently processing |
completed | Finished successfully |
failed | Encountered an error |
cancelled | Cancelled by user |
client.queue.subscribe()
Subscribe to real-time task updates (SSE).
for await (const of await ..({ })) {
if (. === "completed") {
break;
}
}client.queue.result()
Get the final result of a completed task.
const = await ..({ });client.queue.cancel()
Cancel a pending or running task.
const { } = await ..({ });How is this guide?