arangojs
arangojs copied to clipboard
Async result management using /_api/job
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.
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.