C. Scott Ananian has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401692 )
Change subject: Use Promise.async/yield in tools/fetch-sitematrix.js ...................................................................... Use Promise.async/yield in tools/fetch-sitematrix.js Also update the sitematrix. Depends-On: I732ae30a5295f6b1f833553c2293bec8b13ff1c9 Change-Id: I61ae8d09a6a415ec030f95d3a4fc99d2448b676c --- M lib/config/sitematrix.json M tools/fetch-sitematrix.js 2 files changed, 16 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/92/401692/1 diff --git a/lib/config/sitematrix.json b/lib/config/sitematrix.json index c87fde4..9c4c04d 100644 --- a/lib/config/sitematrix.json +++ b/lib/config/sitematrix.json @@ -7027,7 +7027,7 @@ "url": "https://wa.wiktionary.org", "dbname": "wawiktionary", "code": "wiktionary", - "sitename": "Wiktionary" + "sitename": "Wiccionaire" }, { "url": "https://wa.wikibooks.org", @@ -7911,7 +7911,8 @@ "dbname": "transitionteamwiki", "code": "transitionteam", "sitename": "Transition Team Wiki", - "private": "" + "private": "", + "closed": "" }, { "url": "https://ua.wikimedia.org", diff --git a/tools/fetch-sitematrix.js b/tools/fetch-sitematrix.js index 01f3511..ff1b8f3 100755 --- a/tools/fetch-sitematrix.js +++ b/tools/fetch-sitematrix.js @@ -9,22 +9,25 @@ require('../core-upgrade.js'); var Promise = require('../lib/utils/promise.js'); -var fs = require('fs'); +var Util = require('../lib/utils/Util.js').Util; + +var fs = require('pn/fs'); var path = require('path'); -var writeFile = Promise.promisify(fs.writeFile, false, fs); -var request = Promise.promisify(require('request'), true); var downloadUrl = 'https://en.wikipedia.org/w/api.php?action=sitematrix&format=json'; var filename = path.join(__dirname, '/../lib/config/sitematrix.json'); -request({ - url: downloadUrl, - json: true, -}).spread(function(res, body) { +Promise.async(function *() { + var resp = yield Util.retryingHTTPRequest(1, { + url: downloadUrl, + json: true, + }); + var res = resp[0]; + var body = resp[1]; if (res.statusCode !== 200) { throw 'Error fetching sitematrix! Returned ' + res.statusCode; } - return writeFile(filename, JSON.stringify(body, null, '\t')); -}).then(function() { + yield fs.writeFile(filename, JSON.stringify(body, null, '\t')); + console.log('Wrote', filename); console.log('Success!'); -}).done(); +})().done(); -- To view, visit https://gerrit.wikimedia.org/r/401692 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61ae8d09a6a415ec030f95d3a4fc99d2448b676c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits