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

Change subject: linter: Only send API requests if the revision is the latest
......................................................................


linter: Only send API requests if the revision is the latest

We also verify this in the MW API extension, but this will reduce the
number of API requests that are sent.

Change-Id: Idc64c9baf389f590d91aabda7d8226304425d992
---
M lib/logger/linter.js
1 file changed, 18 insertions(+), 14 deletions(-)

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



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 3d0cdf7..7a8b5e6 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -19,20 +19,24 @@
                if (!this._env.conf.parsoid.linterAPI) {
                        console.log(this.buffer);
                } else {
-                       request.post(
-                               this._env.conf.parsoid.linterAPI,
-                               { form: {
-                                       data: JSON.stringify(this.buffer),
-                                       page: this._env.page.name,
-                                       revision: 
this._env.page.meta.revision.revid,
-                                       action: 'record-lint',
-                                       format: 'json',
-                                       formatversion: 2,
-                               }, },
-                               function(error, response, body) {
-                                       console.log(body);
-                               }
-                       );
+                       // Only send the request if it is
+                       // the latest revision
+                       if (this._env.page.meta.revision.revid === 
this._env.page.latest) {
+                               request.post(
+                                       this._env.conf.parsoid.linterAPI,
+                                       { form: {
+                                               data: 
JSON.stringify(this.buffer),
+                                               page: this._env.page.name,
+                                               revision: 
this._env.page.meta.revision.revid,
+                                               action: 'record-lint',
+                                               format: 'json',
+                                               formatversion: 2,
+                                       }, },
+                                       function(error, response, body) {
+                                               console.log(body);
+                                       }
+                               );
+                       }
                }
                this.buffer = [];
                return;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc64c9baf389f590d91aabda7d8226304425d992
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to