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

@ -7,11 +7,11 @@ import * as Acct from '@/misc/acct.js';
import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js';
import { DownloadService } from '@/core/DownloadService.js';
import { UtilityService } from '@/core/UtilityService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type Bull from 'bull';
import type { DbUserImportJobData, DbUserImportToDbJobData } from '../types.js';
import { bindThis } from '@/decorators.js';
import { QueueService } from '@/core/QueueService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserImportJobData, DbUserImportToDbJobData } from '../types.js';
@Injectable()
export class ImportFollowingProcessorService {
@ -34,12 +34,11 @@ export class ImportFollowingProcessorService {
}
@bindThis
public async process(job: Bull.Job<DbUserImportJobData>, done: () => void): Promise<void> {
public async process(job: Bull.Job<DbUserImportJobData>): Promise<void> {
this.logger.info(`Importing following of ${job.data.user.id} ...`);
const user = await this.usersRepository.findOneBy({ id: job.data.user.id });
if (user == null) {
done();
return;
}
@ -47,7 +46,6 @@ export class ImportFollowingProcessorService {
id: job.data.fileId,
});
if (file == null) {
done();
return;
}
@ -56,7 +54,6 @@ export class ImportFollowingProcessorService {
this.queueService.createImportFollowingToDbJob({ id: user.id }, targets);
this.logger.succ('Import jobs created');
done();
}
@bindThis
@ -85,7 +82,7 @@ export class ImportFollowingProcessorService {
}
if (target == null) {
throw `Unable to resolve user: @${username}@${host}`;
throw new Error(`Unable to resolve user: @${username}@${host}`);
}
// skip myself