Revert "enhance(backend): migrate bull to bullmq (#10910)"

This reverts commit fd7b77c542.
This commit is contained in:
riku6460 2023-06-15 02:57:13 +09:00
parent cc87ef9e76
commit 9b3a92e999
No known key found for this signature in database
GPG key ID: 27414FA27DB94CF6
42 changed files with 509 additions and 542 deletions

View file

@ -9,10 +9,10 @@ import type Logger from '@/logger.js';
import { DriveService } from '@/core/DriveService.js';
import { createTemp } from '@/misc/create-temp.js';
import { UtilityService } from '@/core/UtilityService.js';
import { bindThis } from '@/decorators.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type Bull from 'bull';
import type { DbJobDataWithUser } from '../types.js';
import { bindThis } from '@/decorators.js';
@Injectable()
export class ExportBlockingProcessorService {
@ -36,11 +36,12 @@ export class ExportBlockingProcessorService {
}
@bindThis
public async process(job: Bull.Job<DbJobDataWithUser>): Promise<void> {
public async process(job: Bull.Job<DbJobDataWithUser>, done: () => void): Promise<void> {
this.logger.info(`Exporting blocking of ${job.data.user.id} ...`);
const user = await this.usersRepository.findOneBy({ id: job.data.user.id });
if (user == null) {
done();
return;
}
@ -68,7 +69,7 @@ export class ExportBlockingProcessorService {
});
if (blockings.length === 0) {
job.updateProgress(100);
job.progress(100);
break;
}
@ -98,7 +99,7 @@ export class ExportBlockingProcessorService {
blockerId: user.id,
});
job.updateProgress(exportedCount / total);
job.progress(exportedCount / total);
}
stream.end();
@ -111,5 +112,7 @@ export class ExportBlockingProcessorService {
} finally {
cleanup();
}
done();
}
}