jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/387458 )

Change subject: T123446: Bring back request timeouts
......................................................................


T123446: Bring back request timeouts

Change-Id: I39761bff7679a3cfbbde27951a6f094043a67c6b
---
M lib/api/ParsoidService.js
M lib/api/apiUtils.js
M lib/api/routes.js
3 files changed, 6 insertions(+), 2 deletions(-)

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



diff --git a/lib/api/ParsoidService.js b/lib/api/ParsoidService.js
index 5c31704..b36b7c8 100644
--- a/lib/api/ParsoidService.js
+++ b/lib/api/ParsoidService.js
@@ -70,6 +70,7 @@
                        maxConcurrentWorkers: numWorkers,
                        maxConcurrentCallsPerWorker: 1,
                        maxConcurrentCalls: parsoidConfig.maxConcurrentCalls * 
numWorkers,
+                       maxCallTime: parsoidConfig.timeouts.request,
                        // Crashes will retry, timeouts won't, as far as 
testing showed,
                        // but it's documented differently.  Anyways, we don't 
want retries.
                        maxRetries: 0,
diff --git a/lib/api/apiUtils.js b/lib/api/apiUtils.js
index fbe9f52..7bf3c76 100644
--- a/lib/api/apiUtils.js
+++ b/lib/api/apiUtils.js
@@ -159,6 +159,9 @@
        if (err.type === 'MaxConcurrentCallsError') {
                err.suppressLoggingStack = true;
                err.httpStatus = 503;
+       } else if (err.type === 'TimeoutError') {
+               err.suppressLoggingStack = true;
+               err.httpStatus = 504;
        }
        env.log('fatal/request', err);
 };
diff --git a/lib/api/routes.js b/lib/api/routes.js
index e369436..8caa0e7 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -19,7 +19,6 @@
 module.exports = function(parsoidConfig, processLogger, parsoidOptions, parse) 
{
        var routes = {};
        var metrics = parsoidConfig.metrics;
-       var REQ_TIMEOUT = parsoidConfig.timeouts.request;
 
        // This helper is only to be used in middleware, before an environment
        // is setup.  The logger doesn't emit the expected location info.
@@ -118,6 +117,7 @@
 
        var activeRequests = new Map();
        routes.updateActiveRequests = function(req, res, next) {
+               if (parsoidConfig.useWorker) { return next(); }
                var buf = new Buffer(16);
                uuid(null, buf);
                var id = buf.toString('hex');
@@ -132,7 +132,7 @@
                                processLogger.log('fatal', 'Timed out 
processing: ' + location);
                                // `processLogger` is async; give it some time 
to deliver the msg.
                                setTimeout(function() { process.exit(1); }, 
100);
-                       }, REQ_TIMEOUT),
+                       }, parsoidConfig.timeouts.request),
                });
                var current = [];
                activeRequests.forEach(function(val) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I39761bff7679a3cfbbde27951a6f094043a67c6b
Gerrit-PatchSet: 21
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Sbailey <[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