jenkins-bot has submitted this change and it was merged.

Change subject: Reduce contention in RT server with a random offset
......................................................................


Reduce contention in RT server with a random offset

Use the old technique to reduce contention.

Change-Id: I066e1fb618ee8754329d1422a144f1507548e265
---
M js/tests/server/server.js
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/tests/server/server.js b/js/tests/server/server.js
index 26d524b..4544f13 100755
--- a/js/tests/server/server.js
+++ b/js/tests/server/server.js
@@ -145,7 +145,7 @@
        '( claim_hash != ? OR ' +
                '( claim_num_tries <= ? AND claim_timestamp < ? ) ) ' +
        'ORDER BY claim_num_tries DESC, latest_score DESC, ' +
-       'claim_timestamp ASC LIMIT 1';
+       'claim_timestamp ASC LIMIT ?,1';
 
 var dbIncrementFetchErrorCount =
        'UPDATE pages SET num_fetch_errors = num_fetch_errors + 1 WHERE title = 
? AND prefix = ?';
@@ -414,9 +414,13 @@
 };
 
 var claimPage = function( commitHash, cutOffTimestamp, req, res ) {
-       var trans = db.startTransaction();
+       var trans = db.startTransaction(),
+               // reduce contention with a random offset
+               randOffset = Math.floor(Math.random() * 20);
 
-       trans.query( dbGetTitle, [ maxFetchRetries, commitHash, maxTries, 
cutOffTimestamp ], function( err, rows ) {
+       trans.query( dbGetTitle,
+                       [ maxFetchRetries, commitHash, maxTries, 
cutOffTimestamp, randOffset ],
+                       function( err, rows ) {
                if ( err ) {
                        trans.rollback( function() {
                                console.error( 'Error getting next title: ' + 
err.toString() );

-- 
To view, visit https://gerrit.wikimedia.org/r/89491
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I066e1fb618ee8754329d1422a144f1507548e265
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Marcoil <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to