add a little debugging info to batch-read

This commit is contained in:
ansuz 2019-09-06 15:03:42 +02:00
parent cb3df0552b
commit 29813e485d
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,7 @@ read('./pewpew.txt', function (err, data) {
*/
module.exports = function () {
module.exports = function (/* task */) {
var map = {};
return function (id, cb, impl) {
if (typeof(cb) !== 'function' || typeof(impl) !== 'function') {
@ -49,6 +49,9 @@ module.exports = function () {
map[id] = [cb];
impl(function () {
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); }
map[id].forEach(function (h) {
h.apply(null, args);
});