Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The "problem", such as it is, is on the server side: the client has made a well formed request, but the server can not satisfy it. So I'm inclined to a "Server Error", 5xx status code. Quoth <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">the standard</a>:</p> <blockquote> <p>Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request... the server SHOULD include an entity [indicating] whether it is a temporary or permanent condition.</p> </blockquote> <p>Note</p> <ul> <li>"erred <strong>or</strong> is incapable of performing the request": despite their title of "Server Error", they are not just for server errors.</li> <li>"<strong>temporary</strong> or permanent": these codes are suitable for temporarily unavailable resources, like yours.</li> </ul> <p>Of the available codes, I'd say 503, "Service Unavailable" was the best fit:</p> <blockquote> <p>The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response. </p> </blockquote> <p>Note:</p> <ul> <li>"a temporary condition which will be alleviated after some delay": true for your case.</li> <li>"temporary overloading": not pedantically true for your case. But, it could be argued, were your server much faster, the batch processing would have already been done when the client made the request, so it <em>is</em> a kind of "overloading": the client is asking for resources faster than the server can make them available.</li> <li>"the client SHOULD handle the response as it would for a 500 response.": which is "Internal Server Error", the kind of response when the server fails because of a bug. The standard seems to be implying that a well behaved client should <em>not</em> retry in this case. Retrying is suitable for your service, so your reply ought to include a <code>Retry-After</code> value. You could provide as the value the estimated completion time of the next execution of the batch process, or the execution interval of the batch process.</li> </ul> <p>Defining your own 5xx status code (591, for example), although <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1">permitted</a>, would have the wrong semantics:</p> <blockquote> <p>HTTP status codes are extensible... applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class</p> </blockquote> <p>Clients would treat your own status code as 500, "Internal Server Error", which (as I discussed above) would not be right.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload