Browse Source

Merge branch 'release/2.1.2'

master
Bryan Donovan 8 years ago
parent
commit
6751c105d0
  1. 3
      History.md
  2. 8
      lib/callback_filler.js
  3. 2
      package.json
  4. 13
      test/caching.unit.js

3
History.md

@ -1,3 +1,6 @@
- 2.1.2 2016-06-08
- Checking that callback array exists before iterating over it (#69).
- 2.1.1 2016-05-24
- Fixing version number in package.json.

8
lib/callback_filler.js

@ -6,9 +6,11 @@ CallbackFiller.prototype.fill = function(key, err, data) {
var waiting = this.queues[key];
delete this.queues[key];
waiting.forEach(function(task) {
(task.cb)(err, data);
});
if (waiting && waiting.length) {
waiting.forEach(function(task) {
(task.cb)(err, data);
});
}
};
CallbackFiller.prototype.has = function(key) {

2
package.json

@ -1,6 +1,6 @@
{
"name": "cache-manager",
"version": "2.1.1",
"version": "2.1.2",
"description": "Cache module for Node.js",
"main": "index.js",
"scripts": {

13
test/caching.unit.js

@ -515,6 +515,19 @@ describe("caching", function() {
});
});
context("when callback called twice by client", function() {
it("it does not throw an error", function(done) {
cache.wrap(key, function(cb) {
methods.getWidget(name, cb);
methods.getWidget(name, cb);
}, opts, function(err, widget) {
checkErr(err);
assert.deepEqual(widget, {name: name});
setTimeout(done, 10);
});
});
});
it("lets us make nested calls", function(done) {
function getCachedWidget(name, cb) {
cache.wrap(key, function(cacheCb) {

Loading…
Cancel
Save