On Sat, Jul 18, 2009 at 11:39, Russell Blau<[email protected]> wrote: > Carl Fürstenberg wrote on Friday, July 17, 2009 5:19 PM: >> I don't agree with your notion at all. max-lag should be >> handled outside the normal API system, and should be returned >> as 503. The nevessary headers are allready there, so your >> argument that you would need to parse the api-response twice >> is just wrong; Following pseudo code would be how maxlag >> should be handled: >> >> function handle_response() { >> if status == 503 >> sleep( get_header_value( "Retry-After" ) ) >> http_post( this->post, this->handle_response ) >> return >> endif >> >> parse_api() >> blablabla() >> } >> > Your argument assumes that all HTTP 503 errors are caused by maxlag, but > this is not necessarily the case. > http://www.mediawiki.org/wiki/Manual:Maxlag_parameter. If the 503 is caused > by a squid timeout, your pseudocode will fail. Further the response body > might or might not be a valid api response on a 503; if it were a maxlag > issue, it would be an api response inside the HTML body, but if it were a > squid timeout it would just be an HTML message not containing an api > response. So I think Roan's decision was correct. > > Russ > > > _______________________________________________ > Mediawiki-api mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/mediawiki-api >
The response body is irrelevant when a 503 is returned, you should use up to the three headers available instead of parsing the body. -- /Carl Fürstenberg <[email protected]> _______________________________________________ Mediawiki-api mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
