Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gofer

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gofer - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

36

lib/hub.js

@@ -47,6 +47,6 @@ /*

module.exports = Hub = function () {
var hub, logPendingRequests, setupConnectTimeout;
var hub, logPendingRequests, setupCompletionTimeout, setupTimeouts;
hub = new EventEmitter;
hub.fetch = function (options, cb) {
var fetchId, fetchStart, hubHeaders, req, responseData;
var completionTimeoutInterval, connectTimeoutInterval, fetchId, fetchStart, hubHeaders, req, responseData;
fetchStart = microtime.nowDouble();

@@ -118,3 +118,5 @@ fetchId = generateUUID();

});
setupConnectTimeout(null != options.connectTimeout ? options.connectTimeout : Hub.connectTimeout, req, responseData);
connectTimeoutInterval = null != options.connectTimeout ? options.connectTimeout : Hub.connectTimeout;
completionTimeoutInterval = options.completionTimeout;
setupTimeouts(connectTimeoutInterval, completionTimeoutInterval, req, responseData);
return req;

@@ -144,3 +146,3 @@ };

};
setupConnectTimeout = function (connectTimeoutInterval, request, responseData) {
setupTimeouts = function (connectTimeoutInterval, completionTimeoutInterval, request, responseData) {
return request.on('request', function (req) {

@@ -164,3 +166,4 @@ return req.on('socket', function (socket) {

clearTimeout(connectTimeout);
return connectTimeout = null;
connectTimeout = null;
return setupCompletionTimeout(completionTimeoutInterval, req, responseData);
};

@@ -173,2 +176,25 @@ connectingSocket = null != socket.socket ? socket.socket : socket;

};
setupCompletionTimeout = function (completionTimeoutInterval, req, responseData) {
var completionSuccessful, completionTimedOut, completionTimeout;
if (!completionTimeoutInterval)
return;
completionTimeout = void 0;
completionTimedOut = function () {
var err;
req.abort();
responseData.completionDuration = microtime.nowDouble() - responseData.connectDuration;
err = new Error('ETIMEDOUT');
err.code = 'ETIMEDOUT';
err.message = 'Response timed out after ' + completionTimeoutInterval + 'ms';
err.responseData = responseData;
return req.emit('error', err);
};
completionSuccessful = function () {
responseData.completionDuration = microtime.nowDouble() - responseData.connectDuration;
clearTimeout(completionTimeout);
return completionTimeout = null;
};
req.on('complete', completionSuccessful);
return completionTimeout = setTimeout(completionTimedOut, completionTimeoutInterval);
};
return hub;

@@ -175,0 +201,0 @@ };

2

package.json
{
"name": "gofer",
"version": "1.0.2",
"version": "1.1.0",
"description": "A general purpose service client library for node.js",

@@ -5,0 +5,0 @@ "main": "lib/gofer.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc