+7
-3
@@ -111,3 +111,5 @@ var EventEmitter = require('events').EventEmitter | ||
| var tid = setTimeout(function taskTimeout() { | ||
| taskCallback(new Error('Task timed out')); | ||
| var err = new Error('Task timed out'); | ||
| err.args = args; | ||
| taskCallback(err); | ||
| taskTimedOut = true; | ||
@@ -158,5 +160,7 @@ }, timeout); | ||
| // add custom callback to args | ||
| args.push(taskCallback); | ||
| var args2 = args.slice(); | ||
| args2.push(taskCallback); | ||
| this.worker.apply(null, args); | ||
| // call the worker | ||
| this.worker.apply(null, args2); | ||
| }; | ||
@@ -163,0 +167,0 @@ |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "keywords": ["queue", "flow", "time"], | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -20,9 +20,11 @@ var TimeQueue = require('..') | ||
| describe('With tasks that lag', function() { | ||
| var q = new TimeQueue(function() {}, { timeout: 50 }); | ||
| var q = new TimeQueue(function(a, b, callback) {}, { timeout: 50 }); | ||
| it('Should throw an error', function(done) { | ||
| q.push(); | ||
| q.push(3, 4); | ||
| q.on('error', function(err) { | ||
| assert(err); | ||
| assert.equal(err.message, 'Task timed out'); | ||
| assert.equal(err.args[0], 3); | ||
| assert.equal(err.args[1], 4); | ||
| done(); | ||
@@ -32,6 +34,8 @@ }); | ||
| it('Should call the callback with the error', function() { | ||
| q.push(function(err) { | ||
| it('Should call the callback with the error', function(done) { | ||
| q.push('hello!', 'world', function(err) { | ||
| assert(err); | ||
| assert.equal(err.message, 'Task timed out'); | ||
| assert.equal(err.args[0], 'hello!'); | ||
| assert.equal(err.args[1], 'world'); | ||
| done(); | ||
@@ -38,0 +42,0 @@ }); |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
15426
1.99%383
2.13%