I noticed that the live wikimedia servers now have a version of the API that respects the maxlag parameter, which is great. Thanks to the people who got that working.
The correct action when getting a maxlag error is to sleep for at least as long as the current lag. A nice feature of the HTTP maxlag error produced by index.php is that an HTTP header 'Retry-After' that directly tells how long to wait.
I looked at the API code this afternoon to see if I could add another field to the error object that would directly include the lag, so that I don't have to parse it out of the text of the info field. I dicovered that the error objects at the moment can only have two fields, 'code' and 'info'.
That explained to me why bug 11404 was resolved the way it was. In that bug, there was no easy way to distinguish between different sorts of internal errors without parsing the info field. It was resolved by changing the error code to directly reflect the type of internal error encountered.
I don't mind writing a patch to permit different instances of UsageException to carry extra information in addition to 'code' and 'info', but I don't want to invest the coding time unless other people think it's worthwhile.
- Carl