don't continue iterating in listChannels until a the current task has called back

This commit is contained in:
ansuz
2019-06-13 11:54:42 +02:00
parent 2605d27e3f
commit cb0c4ee944
3 changed files with 120 additions and 26 deletions

View File

@@ -253,7 +253,8 @@ var listChannels = function (root, handler, cb) {
// otherwise throw it on the pile
sema.take(function (give) {
Fs.stat(filepath, w(give(function (err, stats) {
var next = give();
Fs.stat(filepath, w(function (err, stats) {
if (err) {
return void handler(err);
}
@@ -264,8 +265,8 @@ var listChannels = function (root, handler, cb) {
mtime: stats.mtime,
ctime: stats.ctime,
size: stats.size,
});
})));
}, next);
}));
});
});
})));