Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1141#discussion_r93389394
--- Diff: lib/nodejs/lib/thrift/http_connection.js ---
@@ -214,6 +214,18 @@ HttpConnection.prototype.write = function(data) {
var req = (self.https) ?
https.request(self.nodeOptions, self.responseCallback) :
http.request(self.nodeOptions, self.responseCallback);
+
+ //support for timeout
+ var timeout = self.nodeOptions.timeout;
+ if(timeout){
+ req.on('socket', function (socket) {
+ socket.setTimeout(timeout);
+ socket.on('timeout', function() {
+ req.abort();
+ });
+ });
+ }
--- End diff --
Makes sense.
For newer versions of Node, it can become potentially problematic to do
redundant timeout handling.
Current Node implementation seems to be ending up with setting socket
timeout, so it may not be a problem for now.
Do you have any idea how to check whether the option is supported ?
Another minor point: we can reduce one indent level by using
req.setTimeout(timeout, func...) ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---