New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

furkot-directions

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

furkot-directions - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

8

History.md
0.0.13 / 2017-01-14
===================
* use the same limiter for all Google requests
* simplify unwiding outstanding requests upon abort
* skip limiter interval when not executing a request because query has been aborted
* limiter-component 0.2.1 -> 1.0.0
0.0.12 / 2017-01-13

@@ -3,0 +11,0 @@ ===================

1

lib/directions.js

@@ -98,2 +98,3 @@ var _defaults = require('lodash.defaults');

name: service.name,
limiter: options[(service.name + '_limiter')],
enable: options[(service.name + '_enable')],

@@ -100,0 +101,0 @@ skip: service.skip

43

lib/service/index.js

@@ -47,19 +47,11 @@ var _defaults = require('lodash.defaults');

}
if (outstanding[queryId].subquery) {
return options.abort(outstanding[queryId].subquery);
// cancel later request if scheduled
if (outstanding[queryId].laterTimeoutId) {
clearTimeout(outstanding[queryId].laterTimeoutId);
}
if (outstanding[queryId].query) {
return options.abort(outstanding[queryId].query);
// cancel request in progress
if (outstanding[queryId].reqInProgress) {
outstanding[queryId].reqInProgress.abort();
}
if (outstanding[queryId]) {
// cancel later request if scheduled
if (outstanding[queryId].laterTimeoutId) {
clearTimeout(outstanding[queryId].laterTimeoutId);
}
// cancel request in progress
if (outstanding[queryId].reqInProgress) {
outstanding[queryId].reqInProgress.abort();
}
outstanding[queryId].callback('aborted');
}
outstanding[queryId].callback(ERROR);
}

@@ -107,3 +99,2 @@

if (segments !== query) {
outstanding[queryId].query = queryId + 'q';
return directions(outstanding[queryId].query, segments,

@@ -127,2 +118,3 @@ new Array(segments.length), function (err, stop, id, query, result) {

// query has been aborted
limiter.skip(); // immediately process the next request in the queue
return;

@@ -160,3 +152,2 @@ }

outstanding[queryId].subquery = queryId + 's';
return directions(outstanding[queryId].subquery, query,

@@ -186,3 +177,9 @@ new Array(1), function (err, stop, id, query, result) {

outstanding[queryId] = {};
outstanding[queryId] = outstanding[queryId] || {
stack: 0
};
outstanding[queryId].stack += 1;
outstanding[queryId].callback = function (err) {
fn(err, true);
};
queryArray.delta = 0;

@@ -192,5 +189,8 @@

if (outstanding[queryId]) {
delete outstanding[queryId];
outstanding[queryId].stack -= 1;
if (!outstanding[queryId].stack) {
delete outstanding[queryId];
}
if (err === ERROR) {
return fn(undefined, true);
return fn(outstanding[queryId] ? err : undefined, true);
}

@@ -205,2 +205,3 @@ fn(err, false, queryId, queryArray, result);

penaltyInterval: 2000,
limiter: limiters[options.name],
request: request,

@@ -210,3 +211,3 @@ abort: abort

options.url = initUrl(options.url);
limiters[options.name] = limiters[options.name] || require('./limiter')(options.interval, options.penaltyInterval);
limiters[options.name] = options.limiter || require('limiter-component')(options.interval, options.penaltyInterval);
limiter = limiters[options.name];

@@ -213,0 +214,0 @@ simplify = require('./simplify')(options);

{
"name": "furkot-directions",
"version": "0.0.12",
"version": "0.0.13",
"description": "Directions service for Furkot",

@@ -23,3 +23,3 @@ "author": {

"geodesy": "^1.1.1",
"limiter-component": "^0.2.1",
"limiter-component": "^1.0.0",
"lodash.defaults": "^4.2.0",

@@ -26,0 +26,0 @@ "run-series": "^1.1.4",

Sorry, the diff of this file is not supported yet

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