Reference · Database
later.status
signature
later.status(str) -> map | nullWhat it does
Says what became of a call made later, from the id .later gave:
{ state: "waiting", tries, error }: not through yet, aftertriestries.{ state: "done", result }: through.resultis what the function gave, an error value if it said no. It is kept for a day.{ state: "failed", error }: given up on, and kept. See Calls made later.null: nothing is known of it, as with a call finished over a day ago, one kept in memory and done, or one in a transaction that has not committed.
error is an error value, as it can name a service's address, so a visitor is not
shown it. It is read outside any transaction.
Examples
print(later.status("no such call"))output
nullA route that makes the call later and gives its id, a route that says how it went, and
the service whose server fn it calls:
in a program
// payments.qweserver fn charge(ref: str) { if ref == "" { return err("no reference") } // done, with an error value as its result { ref, paid: true }}in a program
// main.qweservice payments = "payments.qwe"route POST /charge = payments.later.charge(request.json.ref)route GET /charge/:id { let s = later.status(id) if s == null { return respond(404, "no such charge") } if s.state == "done" && is_err(s.result) { return `refused: ${s.result.error}` } s.state}curl localhost:8080/charge --json '{"ref": "order-17"}' # "a4a241a6cb58b5bd973075e6"curl localhost:8080/charge/a4a241a6cb58b5bd973075e6 # waiting, then doneThread
Thread 0 posts
On later.status(): questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.
Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo