-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maxlog errors are not retried #22
Comments
Sounds like a bug in MW if you ask me. Which version of MediaWiki is this happening in, and do you have a sample of an API response with a maxlog warning? |
I'm noticing this against the English Wikipedia [http://en.wikipedia.org/w/api.php] site, so whatever versions that their various servers are running. Issuing the following query seems to indicate that it is "MediaWiki 1.17wmf1": http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo |
Here's the documentation on maxlag: http://www.mediawiki.org/wiki/Manual:Maxlag_parameter This is an example of what the response might look like in such a situation: The above example is working because I moved the following block of code from get_response() up to the make_api_request() RestClient.post block (I can issue a pull request if you want once I get the code pushed back to GitHub):
This solution isn't particularly elegant, but it gets the job done for the time being. Before I modified the code, below is an example of what would happen when I got a maxlog error. The 200 is the output of response.code at the start of the RestClient.post block in make_api_request().
|
Thanks! Submitted as a MediaWiki bug report, let's see what they respond. If this new behavior is intentional, it'll be time to change the gateway to suit. |
So apparently returning a 200 OK is the new normal. X( Send me a pull request, and I'll merge it in. |
Well, my fix doesn't seem to be working at the moment. The problem seems to be that we eventually return after the successful function call. I need a way of calling the method and then "forgetting" about coming back to the current stack. I'll have to sit down and look at this at some point, but thought I'd share incase someone brighter than me has a graceful solution. Perhaps better leveraging Ruby's exception facilities. |
It appears that contrary to the Wikipedia API documentation, 503 status codes are not being returned when maxlog is greater than the given threshold. Instead, a status code of 200 is returned which causes the maxlog warning to be caught in the get_response() method. This raises an APIError which terminates the execution of the code. Maxlog failures should be retried following the same procedure as for a 503 code [i.e. sleep for the retry_delay up to the retry_count].
Since this error is caught in get_response() instead of make_api_request(), the solution gets a bit tricky to handle with grace....
The text was updated successfully, but these errors were encountered: