jenkins-bot has submitted this change and it was merged. Change subject: Revert "resourceloader: Make cache-eval in mw.loader.work asynchronous" ......................................................................
Revert "resourceloader: Make cache-eval in mw.loader.work asynchronous" This is to be applied to wmf.3 only to help verify the root cause of T146510 one last time. This reverts commit 2a895edbd23f796206e26fb7d08a79fe6c653103. Change-Id: Ie21f5c3a7c34ccb273342fc3952bafd975cec088 --- M resources/src/mediawiki/mediawiki.js 1 file changed, 16 insertions(+), 33 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index d525813..9bb0ec8 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -1666,26 +1666,6 @@ } /** - * @private - * @param {string[]} implementations Array containing pieces of JavaScript code in the - * form of calls to mw.loader#implement(). - * @param {Function} cb Callback in case of failure - * @param {Error} cb.err - */ - function asyncEval( implementations, cb ) { - if ( !implementations.length ) { - return; - } - mw.requestIdleCallback( function () { - try { - $.globalEval( implementations.join( ';' ) ); - } catch ( err ) { - cb( err ); - } - } ); - } - - /** * Make a versioned key for a specific module. * * @private @@ -1738,7 +1718,7 @@ * @protected */ work: function () { - var q, batch, implementations, sourceModules; + var q, batch, concatSource, origBatch; batch = []; @@ -1768,18 +1748,19 @@ mw.loader.store.init(); if ( mw.loader.store.enabled ) { - implementations = []; - sourceModules = []; + concatSource = []; + origBatch = batch; batch = $.grep( batch, function ( module ) { - var implementation = mw.loader.store.get( module ); - if ( implementation ) { - implementations.push( implementation ); - sourceModules.push( module ); + var source = mw.loader.store.get( module ); + if ( source ) { + concatSource.push( source ); return false; } return true; } ); - asyncEval( implementations, function ( err ) { + try { + $.globalEval( concatSource.join( ';' ) ); + } catch ( err ) { // Not good, the cached mw.loader.implement calls failed! This should // never happen, barring ResourceLoader bugs, browser bugs and PEBKACs. // Depending on how corrupt the string is, it is likely that some @@ -1791,14 +1772,16 @@ // something that infected the implement call itself, don't take any // risks and clear everything in this cache. mw.loader.store.clear(); - + // Re-add the ones still pending back to the batch and let the server + // repopulate these modules to the cache. + // This means that at most one module will be useless (the one that had + // the error) instead of all of them. mw.track( 'resourceloader.exception', { exception: err, source: 'store-eval' } ); - // Re-add the failed ones that are still pending back to the batch - var failed = $.grep( sourceModules, function ( module ) { + origBatch = $.grep( origBatch, function ( module ) { return registry[ module ].state === 'loading'; } ); - batchRequest( failed ); - } ); + batch = batch.concat( origBatch ); + } } batchRequest( batch ); -- To view, visit https://gerrit.wikimedia.org/r/322212 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie21f5c3a7c34ccb273342fc3952bafd975cec088 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.29.0-wmf.3 Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits