Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(worker): Reduce distraction errors #6662

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions apps/worker/src/app/shared/utils/cron-health.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/worker/src/app/shared/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './constants';
export * from './exceptions';
export * from './cron-health';
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import {
QueueBaseService,
WorkerOptions,
} from '@novu/application-generic';
import { CronExpressionEnum } from '@novu/shared';
import { Inject, Injectable, Logger } from '@nestjs/common';

import { checkingForCronJob } from '../../shared/utils';

const nr = require('newrelic');

const LOG_CONTEXT = 'ActiveJobMetricService';
Expand All @@ -26,7 +25,6 @@ export class ActiveJobsMetricService {
this.activeJobsMetricWorkerService.createWorker(this.getWorkerProcessor(), this.getWorkerOptions());

this.activeJobsMetricWorkerService.worker.on('completed', async (job) => {
await checkingForCronJob(process.env.ACTIVE_CRON_ID);
Logger.log({ jobId: job.id }, 'Metric Completed Job', LOG_CONTEXT);
});

Expand Down Expand Up @@ -66,7 +64,7 @@ export class ActiveJobsMetricService {
repeatJobKey: METRIC_JOB_ID,
repeat: {
immediately: true,
pattern: '* * * * * *',
pattern: CronExpressionEnum.EVERY_30_SECONDS,
},
removeOnFail: true,
removeOnComplete: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class DistributedLockService {
* when an "error" event is emitted in the absence of listeners.
*/
this.distributedLock.on('error', (error) => {
Logger.error(
Logger.verbose(
error,
'There has been an error in the Distributed Lock service',
LOG_CONTEXT,
Expand Down
Loading