mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
refactor(core): Use an IoC container to manage singleton classes [Part-2] (no-changelog) (#5690)
* use typedi for UserManagementMailer * use typedi for SamlService * fix typos * use typedi for Queue * use typedi for License * convert some more code to use typedi
This commit is contained in:
committed by
GitHub
parent
c07f838ce6
commit
9bd7529193
@@ -1,10 +1,10 @@
|
||||
import type Bull from 'bull';
|
||||
import type { RedisOptions } from 'ioredis';
|
||||
import { Service } from 'typedi';
|
||||
import type { IExecuteResponsePromiseData } from 'n8n-workflow';
|
||||
import config from '@/config';
|
||||
import { ActiveExecutions } from '@/ActiveExecutions';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
export type JobId = Bull.JobId;
|
||||
export type Job = Bull.Job<JobData>;
|
||||
@@ -24,6 +24,7 @@ export interface WebhookResponse {
|
||||
response: IExecuteResponsePromiseData;
|
||||
}
|
||||
|
||||
@Service()
|
||||
export class Queue {
|
||||
private jobQueue: JobQueue;
|
||||
|
||||
@@ -91,14 +92,3 @@ export class Queue {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let activeQueueInstance: Queue | undefined;
|
||||
|
||||
export async function getInstance(): Promise<Queue> {
|
||||
if (activeQueueInstance === undefined) {
|
||||
activeQueueInstance = new Queue(Container.get(ActiveExecutions));
|
||||
await activeQueueInstance.init();
|
||||
}
|
||||
|
||||
return activeQueueInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user