-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Current implementation is synchronous. HTTP spec allows for async handling via status code 202 (https://tools.ietf.org/html/rfc7231#section-6.3.3)
This should be implemented something like follows:
- Request comes in to function that is "registered" as asynchronous (when defining API)
- Request is added to a
queuetable which will track details of (at least)- job ID
- function & args
- status (waiting, in progress, done)
- 202 response sent to initial request with
Locationheader for queued resource e.g.
HTTP/1.1 202 Accepted
Location: /queue/12345- Client can query
/queue/12345for updated status on job - A some time after request has been added to
queue, it will be processed & status updated to done - When client queries
/queue/12345for completed job, response will be status 303 See Other (https://tools.ietf.org/html/rfc7231#section-6.4.4) with location of finished response e.g.
HTTP/1.1 303 See Other
Location: /thing/97865- Client can query new location & get response for their original query
To allow API process to remain responsive to intermediate requests to /queue etc., processing should likely be done by another process, connecting via IPC & querying the queue table to get a job to do. However, this is considered beyond the scope of this module. Within webapi, we will provide the functionality to build the queue & send status updates to incoming queries to /queue.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request