mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
⚡ Simplify config imports in cli package (#1840)
* ⚡ Set path alias for config * ⚡ Update config export * ⚡ Simplify config imports * ⚡ Update also additional imports * ⚡ Update path in collation migration * ⚡ Resolve aliased paths * 👕 Fix Codacy issue * 👕 Retry to fix Codacy issue Co-authored-by: Jan <janober@users.noreply.github.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import * as Bull from 'bull';
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import { IBullJobData } from './Interfaces';
|
||||
|
||||
export class Queue {
|
||||
private jobQueue: Bull.Queue;
|
||||
|
||||
|
||||
constructor() {
|
||||
const prefix = config.get('queue.bull.prefix') as string;
|
||||
const redisOptions = config.get('queue.bull.redis') as object;
|
||||
// Disabling ready check is necessary as it allows worker to
|
||||
// Disabling ready check is necessary as it allows worker to
|
||||
// quickly reconnect to Redis if Redis crashes or is unreachable
|
||||
// for some time. With it enabled, worker might take minutes to realize
|
||||
// redis is back up and resume working.
|
||||
@@ -16,25 +16,25 @@ export class Queue {
|
||||
// @ts-ignore
|
||||
this.jobQueue = new Bull('jobs', { prefix, redis: redisOptions, enableReadyCheck: false });
|
||||
}
|
||||
|
||||
|
||||
async add(jobData: IBullJobData, jobOptions: object): Promise<Bull.Job> {
|
||||
return await this.jobQueue.add(jobData,jobOptions);
|
||||
}
|
||||
|
||||
|
||||
async getJob(jobId: Bull.JobId): Promise<Bull.Job | null> {
|
||||
return await this.jobQueue.getJob(jobId);
|
||||
}
|
||||
|
||||
|
||||
async getJobs(jobTypes: Bull.JobStatus[]): Promise<Bull.Job[]> {
|
||||
return await this.jobQueue.getJobs(jobTypes);
|
||||
}
|
||||
|
||||
|
||||
getBullObjectInstance(): Bull.Queue {
|
||||
return this.jobQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param job A Bull.Job instance
|
||||
* @returns boolean true if we were able to securely stop the job
|
||||
*/
|
||||
@@ -62,6 +62,6 @@ export function getInstance(): Queue {
|
||||
if (activeQueueInstance === undefined) {
|
||||
activeQueueInstance = new Queue();
|
||||
}
|
||||
|
||||
|
||||
return activeQueueInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user