1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-16 22:35:27 +02:00

リファクタリング syuilo#4587 (#4766)

This commit is contained in:
MeiMei
2019-04-22 03:22:19 +09:00
committed by syuilo
parent acd4b101e1
commit 6b726eea39
8 changed files with 17 additions and 37 deletions

View File

@@ -16,10 +16,9 @@ export async function deleteDriveFiles(job: Bull.Job, done: any): Promise<void>
});
let deletedCount = 0;
let ended = false;
let cursor: any = null;
while (!ended) {
while (true) {
const files = await DriveFile.find({
userId: user._id,
...(cursor ? { _id: { $gt: cursor } } : {})
@@ -31,7 +30,6 @@ export async function deleteDriveFiles(job: Bull.Job, done: any): Promise<void>
});
if (files.length === 0) {
ended = true;
job.progress(100);
break;
}

View File

@@ -32,10 +32,9 @@ export async function exportBlocking(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 blockings = await Blocking.find({
blockerId: user._id,
...(cursor ? { _id: { $gt: cursor } } : {})
@@ -47,7 +46,6 @@ export async function exportBlocking(job: Bull.Job, done: any): Promise<void> {
});
if (blockings.length === 0) {
ended = true;
job.progress(100);
break;
}

View File

@@ -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;
}

View File

@@ -32,10 +32,9 @@ export async function exportMute(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 mutes = await Mute.find({
muterId: user._id,
...(cursor ? { _id: { $gt: cursor } } : {})
@@ -47,7 +46,6 @@ export async function exportMute(job: Bull.Job, done: any): Promise<void> {
});
if (mutes.length === 0) {
ended = true;
job.progress(100);
break;
}

View File

@@ -42,10 +42,9 @@ export async function exportNotes(job: Bull.Job, done: any): Promise<void> {
});
let exportedNotesCount = 0;
let ended = false;
let cursor: any = null;
while (!ended) {
while (true) {
const notes = await Note.find({
userId: user._id,
...(cursor ? { _id: { $gt: cursor } } : {})
@@ -57,7 +56,6 @@ export async function exportNotes(job: Bull.Job, done: any): Promise<void> {
});
if (notes.length === 0) {
ended = true;
job.progress(100);
break;
}