Krinkle has uploaded a new change for review. https://gerrit.wikimedia.org/r/322211
Change subject: [DNM] Revert "resourceloader: Make cache-eval in mw.loader.work asynchronous" ...................................................................... [DNM] 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(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/11/322211/1 diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index 6b23439..f878e42 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -1681,26 +1681,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 @@ -1753,7 +1733,7 @@ * @protected */ work: function () { - var q, batch, implementations, sourceModules; + var q, batch, concatSource, origBatch; batch = []; @@ -1783,18 +1763,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 @@ -1805,14 +1786,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/322211 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie21f5c3a7c34ccb273342fc3952bafd975cec088 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits