mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
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:
committed by
GitHub
parent
6cebc7f069
commit
4d9bc30d1f
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user