Hi all,
I am working on this script https://gerrit.wikimedia.org/r/#/c/138539/2/resources/js/ext.translate.speci... for importing old translations into the Translation extension. To do so, I have to create pages in the Translations namespace.
The function createTranslationPages() does that task. I was processing the POST requests in a for loop previously but that was too many POST requests in parallel and I get "MediaWiki-API-Error: badtoken" in the response headers. So I thought of serializing it as per https://www.mediawiki.org/wiki/API:Etiquette#Request_limit with a recursive solution. However, the processing done inside the saveHandler() function happens when the first POST request gets completed and does not wait for all the requests to complete.
Nikerabbit has already commented inline, but I would like to know if this issue has been faced before by someone over here and what is the best solution for this. Thank you.
You can also help with suggestions at this pad: http://etherpad.wikimedia.org/p/pm_serialize_post
wikitech-l@lists.wikimedia.org