Skip to content

Commit 0c5f5bd

Browse files
committed
feat: Add conditional check to skip processing certain jobs in BackendsService
1 parent 64b68be commit 0c5f5bd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/core/backends/_interfaces/worker-result.interface.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { BackendResultInterface } from './backend-result.interface';
22

33
export interface WorkerResultInterface {
4+
jobName?: string;
5+
options?: {
6+
[key: string | number]: any;
7+
};
48
jobId: string;
59
status: number;
610
data: WorkerResultInfoInterface;

src/core/backends/backends.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export class BackendsService extends AbstractQueueProcessor {
4646

4747
const jobsCompleted = await this._queue.getCompleted();
4848
for (const job of jobsCompleted) {
49+
const result = <WorkerResultInterface>(<unknown>job.returnvalue);
50+
if (result.jobName === ActionType.DUMP_PACKAGE_CONFIG || result?.options?.disableLogs === true) {
51+
return;
52+
}
4953
const isSyncedJob = await this.jobsService.model.findOneAndUpdate<Jobs>(
5054
{ jobId: job.id, state: { $nin: [JobState.COMPLETED, JobState.FAILED] } },
5155
{
@@ -110,6 +114,9 @@ export class BackendsService extends AbstractQueueProcessor {
110114
let jState = JobState.COMPLETED;
111115
let iState = IdentityState.SYNCED;
112116
const result = <WorkerResultInterface>(<unknown>payload.returnvalue);
117+
if (result.jobName === ActionType.DUMP_PACKAGE_CONFIG || result?.options?.disableLogs === true) {
118+
return;
119+
}
113120
if (result.status !== 0) {
114121
jState = JobState.FAILED;
115122
iState = IdentityState.ON_ERROR;
@@ -231,6 +238,7 @@ export class BackendsService extends AbstractQueueProcessor {
231238
{
232239
concernedTo,
233240
payload,
241+
options,
234242
},
235243
{
236244
...options?.job,

0 commit comments

Comments
 (0)