|
|
@ -8,6 +8,8 @@ If the result of IO or computation is requested while an identical request
|
|
|
|
is already in progress, wait until the first one completes and provide its
|
|
|
|
is already in progress, wait until the first one completes and provide its
|
|
|
|
result to every routine that requested it.
|
|
|
|
result to every routine that requested it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Asynchrony is guaranteed.
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
Provide:
|
|
|
|
Provide:
|
|
|
@ -51,11 +53,12 @@ module.exports = function (/* task */) {
|
|
|
|
var args = Array.prototype.slice.call(arguments);
|
|
|
|
var args = Array.prototype.slice.call(arguments);
|
|
|
|
|
|
|
|
|
|
|
|
//if (map[id] && map[id].length > 1) { console.log("BATCH-READ DID ITS JOB for [%s][%s]", task, id); }
|
|
|
|
//if (map[id] && map[id].length > 1) { console.log("BATCH-READ DID ITS JOB for [%s][%s]", task, id); }
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
map[id].forEach(function (h) {
|
|
|
|
map[id].forEach(function (h) {
|
|
|
|
h.apply(null, args);
|
|
|
|
h.apply(null, args);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
delete map[id];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
delete map[id];
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|