Browse Source

fix: remove unnecessary logic

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5711/head
mertmit 2 years ago
parent
commit
463ad08abd
  1. 13
      packages/nocodb/src/modules/jobs/redis/jobs.service.ts

13
packages/nocodb/src/modules/jobs/redis/jobs.service.ts

@ -7,21 +7,18 @@ import { JobsRedisService } from './jobs-redis.service';
@Injectable() @Injectable()
export class JobsService { export class JobsService {
private localJobs: string[] = [];
constructor( constructor(
@InjectQueue(JOBS_QUEUE) private readonly jobsQueue: Queue, @InjectQueue(JOBS_QUEUE) private readonly jobsQueue: Queue,
private jobsRedisService: JobsRedisService, private jobsRedisService: JobsRedisService,
private eventEmitter: EventEmitter2, private eventEmitter: EventEmitter2,
) { ) {
if (process.env['NC_REDIS_URL'] && !process.env['NC_WORKER_CONTAINER']) { if (!process.env['NC_WORKER_CONTAINER']) {
this.jobsQueue.pause(true); this.jobsQueue.pause(true);
} }
} }
async add(name: string, data: any) { async add(name: string, data: any) {
const job = await this.jobsQueue.add(name, data); const job = await this.jobsQueue.add(name, data);
this.localJobs.push(job.id.toString());
this.jobsRedisService.subscribe(`jobs-${job.id.toString()}`, (data) => { this.jobsRedisService.subscribe(`jobs-${job.id.toString()}`, (data) => {
const cmd = data.cmd; const cmd = data.cmd;
delete data.cmd; delete data.cmd;
@ -40,14 +37,6 @@ export class JobsService {
return job; return job;
} }
async isLocalJob(jobId: string) {
return this.localJobs.includes(jobId);
}
async removeLocalJob(jobId: string) {
this.localJobs = this.localJobs.filter((j) => j !== jobId);
}
async jobStatus(jobId: string) { async jobStatus(jobId: string) {
const job = await this.jobsQueue.getJob(jobId); const job = await this.jobsQueue.getJob(jobId);
if (job) { if (job) {

Loading…
Cancel
Save