jenkins-bot has submitted this change and it was merged.
Change subject: Filter DOM load/save deferreds through ve.track callback
......................................................................
Filter DOM load/save deferreds through ve.track callback
Binding ve.init.mw.Target#onLoad and the anonymous function which calls ve#track
with timing data to the resolution of the same deferred makes the timing
measurement sensitive to how long it takes ve.init.mw.Target#onLoad to yield,
which in turns depends on whether the requisite ResourceLoader modules for
setting up the editing surface are ready. This muddles the definition of what
we're actually measuring, making it dependent on a race condition.
This patch moves the tracking call to a filter function through which the jqXHR
deferred is threaded. This ensures that the 'duration' datapoint on the domSave
and domLoad events captures just the time spent talking with the API.
Change-Id: I6e162014a4043d4ff9422131ae87fb25d0ab4c29
---
M modules/ve-mw/init/ve.init.mw.Target.js
1 file changed, 17 insertions(+), 17 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js
b/modules/ve-mw/init/ve.init.mw.Target.js
index 81d247b..12ebd5e 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -539,17 +539,17 @@
'timeout': 100000,
'cache': 'false'
} )
+ .then( function ( data, status, jqxhr ) {
+ ve.track( 'performance.domLoad', {
+ 'bytes': $.byteLength( jqxhr.responseText ),
+ 'duration': ve.now() - start,
+ 'cacheHit': /hit/i.test(
jqxhr.getResponseHeader( 'X-Cache' ) ),
+ 'parsoid': jqxhr.getResponseHeader(
'X-Parsoid-Performance' )
+ } );
+ return jqxhr;
+ } )
.done( ve.bind( ve.init.mw.Target.onLoad, this ) )
.fail( ve.bind( ve.init.mw.Target.onLoadError, this ) );
-
- this.loading.done( function ( data, status, jqxhr ) {
- ve.track( 'performance.domLoad', {
- 'bytes': $.byteLength( jqxhr.responseText ),
- 'duration': ve.now() - start,
- 'cacheHit': /hit/i.test( jqxhr.getResponseHeader(
'X-Cache' ) ),
- 'parsoid': jqxhr.getResponseHeader(
'X-Parsoid-Performance' )
- } );
- } );
return true;
};
@@ -598,16 +598,16 @@
// Wait up to 100 seconds before giving up
'timeout': 100000
} )
+ .then( function ( data, status, jqxhr ) {
+ ve.track( 'performance.domSave', {
+ 'bytes': $.byteLength( jqxhr.responseText ),
+ 'duration': ve.now() - start,
+ 'parsoid': jqxhr.getResponseHeader(
'X-Parsoid-Performance' )
+ } );
+ return jqxhr;
+ } )
.done( ve.bind( ve.init.mw.Target.onSave, this ) )
.fail( ve.bind( ve.init.mw.Target.onSaveError, this ) );
-
- this.saving.done( function ( data, status, jqxhr ) {
- ve.track( 'performance.domSave', {
- 'bytes': $.byteLength( jqxhr.responseText ),
- 'duration': ve.now() - start,
- 'parsoid': jqxhr.getResponseHeader(
'X-Parsoid-Performance' )
- } );
- } );
return true;
};
--
To view, visit https://gerrit.wikimedia.org/r/91564
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6e162014a4043d4ff9422131ae87fb25d0ab4c29
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits