1 var AsyncQueue = function () {
7 AsyncQueue.prototype.next = function () {
8 if (this._q.length > 0) {
11 var item = this._q.shift();
13 this._tm = Date.now() + item[1];
18 AsyncQueue.prototype.lock = function () {
20 if (this._tm > 0 && Date.now() > this._tm) {
31 AsyncQueue.prototype.release = function () {
37 setImmediate(function () {
43 AsyncQueue.prototype.queue = function (fn) {
45 self._q.push([fn, 20000]);
49 AsyncQueue.prototype.reset = function () {
54 module.exports = AsyncQueue;