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

* wip

* wip

* Update QueueService.ts

* wip

* refactor

* ✌️

* fix

* Update QueueStatsService.ts

* refactor

* Update ApNoteService.ts

* Update mock-resolver.ts

* refactor

* Update mock-resolver.ts
This commit is contained in:
syuilo 2023-05-29 11:54:49 +09:00 committed by GitHub
parent 7cbd852fe5
commit fd7b77c542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 532 additions and 490 deletions

View file

@ -5,9 +5,9 @@ import type { DriveFilesRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import type Logger from '@/logger.js';
import { DriveService } from '@/core/DriveService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type Bull from 'bull';
import { bindThis } from '@/decorators.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
@Injectable()
export class CleanRemoteFilesProcessorService {
@ -27,7 +27,7 @@ export class CleanRemoteFilesProcessorService {
}
@bindThis
public async process(job: Bull.Job<Record<string, unknown>>, done: () => void): Promise<void> {
public async process(job: Bull.Job<Record<string, unknown>>): Promise<void> {
this.logger.info('Deleting cached remote files...');
let deletedCount = 0;
@ -47,7 +47,7 @@ export class CleanRemoteFilesProcessorService {
});
if (files.length === 0) {
job.progress(100);
job.updateProgress(100);
break;
}
@ -62,10 +62,9 @@ export class CleanRemoteFilesProcessorService {
isLink: false,
});
job.progress(deletedCount / total);
job.updateProgress(deletedCount / total);
}
this.logger.succ('All cached remote files has been deleted.');
done();
}
}