リファクタリング syuilo#4587 (#4766)
This commit is contained in:
parent
acd4b101e1
commit
6b726eea39
8 changed files with 17 additions and 37 deletions
|
|
@ -32,10 +32,9 @@ export async function exportFollowing(job: Bull.Job, done: any): Promise<void> {
|
|||
const stream = fs.createWriteStream(path, { flags: 'a' });
|
||||
|
||||
let exportedCount = 0;
|
||||
let ended = false;
|
||||
let cursor: any = null;
|
||||
|
||||
while (!ended) {
|
||||
while (true) {
|
||||
const followings = await Following.find({
|
||||
followerId: user._id,
|
||||
...(cursor ? { _id: { $gt: cursor } } : {})
|
||||
|
|
@ -47,7 +46,6 @@ export async function exportFollowing(job: Bull.Job, done: any): Promise<void> {
|
|||
});
|
||||
|
||||
if (followings.length === 0) {
|
||||
ended = true;
|
||||
job.progress(100);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue