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

disconnect

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disconnect - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

test/all.js

5

HISTORY.md

@@ -0,1 +1,6 @@

0.3.1 / 2014-06-26
==================
* Fixed a litte bug in the calculation of free positions in the request queue
* Started adding unit tests using `wru`
0.3.0 / 2014-06-24

@@ -2,0 +7,0 @@ ==================

27

lib/queue.js

@@ -23,3 +23,3 @@ var queue = module.exports = {},

function execute(){
stack.shift().call(this, null, (maxItems-stack.length)-1);
stack.shift().callback.call(this, null, (maxItems-stack.length));
return this;

@@ -42,9 +42,11 @@ }

if(len < maxItems){
stack.push(callback);
if(stack.length === 1){ // Immediate execution on empty queue
callback(null, (maxItems-len)-1);
setTimeout(remove, interval); // Remove from queue after interval
var item = {};
if(len === 0){ // Immediate execution on empty queue
callback(null, maxItems-1);
item.timeout = setTimeout(remove, interval); // Remove from queue after interval
}else{ // Queue
setTimeout(execute, (len*interval));
item.callback = callback;
item.timeout = setTimeout(execute, ((len+1)*interval));
}
stack.push(item);
}else{

@@ -57,2 +59,15 @@ callback(new DiscogsError(429, 'Too many requests'), 0);

/**
* Clear the request queue. All queued requests/callbacks will be cancelled!
* @returns {Object}
*/
queue.clear = function(){
var item;
while(item = stack.shift()){
clearTimeout(item.timeout);
}
return this;
};
/**
* Get the current queue length

@@ -59,0 +74,0 @@ * @returns {Number}

{
"name": "disconnect",
"description": "Easy to use client to connect with the discogs.com API v2.0",
"version": "0.3.0",
"description": "An easy to use client library to connect with the discogs.com API v2.0",
"version": "0.3.1",
"keywords": ["discogs", "api", "client", "oauth"],

@@ -22,3 +22,5 @@ "homepage": "https://github.com/bartve/disconnect",

},
"devDependencies": {},
"devDependencies": {
"wru": "0.2.x"
},
"engines": {

@@ -25,0 +27,0 @@ "node": ">= 0.10.0"

@@ -17,3 +17,3 @@ ## About

* Add tests!
* Add more tests

@@ -20,0 +20,0 @@ ## Installation

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