Skip to content

Bug: TypeError when using arrays of keys #2

@rogierschouten

Description

@rogierschouten

Code:

var AsyncLock = require("async-lock");
var lock = new AsyncLock();

function work(cb) {
    return setTimeout(cb, 1000);
}

function done(err, ret) {
    console.log("done", err);
}

lock.acquire(["A", "B", "C"], work, done);
lock.acquire(["A", "B", "C"], work, done);

Output:

done undefined
node_modules\async-lock\lib\index.js:86
                        self.queues[key].shift()();
                                                ^

TypeError: self.queues[key].shift(...) is not a function
    at done (C:\Source\eXLent_master\exlent\node_modules\async-lock\lib\index.js:86:35)
    at C:\Source\eXLent_master\exlent\node_modules\async-lock\lib\index.js:111:9
    at done (C:\Source\eXLent_master\exlent\node_modules\async-lock\lib\index.js:68:12)
    at Timeout._onTimeout (C:\Source\eXLent_master\exlent\node_modules\async-lock\lib\index.js:111:9)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions