arangojs icon indicating copy to clipboard operation
arangojs copied to clipboard

Async result management using /_api/job

Open njbotkin opened this issue 6 years ago • 1 comments

It'd be nice to have an interface for managing jobs. My use-case involves cancelling long-running queries. Using it might look like this:

let job = await db.job(aql`FOR i IN 1..10 FOR j IN 1..10 LET x = sleep(1.0) FILTER i == 5 && j == 5 RETURN 42`)

// wait for job result
let result = await job.result

// or, cancel job
job.cancel()

Not sure how it should be implemented. Seems like the usual way to use the jobs api is to poll for the result, which seems suboptimal.

njbotkin avatar Dec 17 '19 17:12 njbotkin

This is the HTTP API: https://www.arangodb.com/docs/stable/http/async-results-management.html

There's no simple way to implement this as the idea is that any operation can be performed asynchronously and this would currently break things, so this won't land in v7.0.0.

pluma avatar Jun 19 '20 09:06 pluma