feat: async3 upgrade (#7639)

* feat: async3 upgrade WIP

* fix: async.doWhilst

* fix: async early exit

* fix: psql doUntil

* fix: psql again
This commit is contained in:
Barış Soner Uşaklı
2019-05-30 14:36:33 -04:00
committed by GitHub
parent 6cebc7f069
commit 4d9bc30d1f
15 changed files with 35 additions and 32 deletions

View File

@@ -707,14 +707,19 @@ SELECT z."value", z."score"
WHERE o."_key" = $1::TEXT
ORDER BY z."score" ASC, z."value" ASC`, [setKey]));
async.doUntil(function (next) {
var isDone = false;
async.whilst(function (next) {
next(null, !isDone);
}, function (next) {
query.read(batchSize, function (err, rows) {
if (err) {
return next(err);
}
if (!rows.length) {
return next(null, true);
isDone = true;
return next();
}
rows = rows.map(function (row) {
@@ -735,8 +740,6 @@ SELECT z."value", z."score"
}
});
});
}, function (stop) {
return stop;
}, function (err) {
done();
callback(err);