Picadabra Docs

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'
StatusDescription
pendingQueued, not started
runningCurrently processing
completedFinished successfully
failedEncountered an error
cancelledCancelled 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?