Closed ianroberts closed 1 year ago
Many thanks for this, and sorry for the delay!
I agree.
Other background docs of relevance:
Changes in https://github.com/ucam-department-of-psychiatry/crate/pull/111:
fetch_from_queue
as above, providing optional status information.
The current NLPRP API specification states that if a client calls
fetch_from_queue
on aqueue_id
that is not yet finished processing, then the server should respond with HTTP status code 102 ("Processing"). However status codes below 200 are supposed to be "intermediate" codes and shouldn't be used as the final status of an HTTP exchange - the idea of 102 is that the server can return this intermediate code without closing the connection, as a way to say "I haven't died, I'm still working on it..." and then follow up with a final 200 or higher code when the processing is finishedHowever it's not clear what to suggest instead - it's not a 4xx client error (the request is perfectly valid, it's just that the result isn't yet ready) and it's not a 5xx server error (nothing has actually gone wrong). The most appropriate response would appear to be 202 Accepted:
Possibly with a response body where the server can indicate some kind of progress counter, if it is able to determine such (e.g. percentage of tasks completed so far).