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

feat(app-generic): add log for subscriber not processed when trigger #3924

Merged
merged 1 commit into from
Aug 4, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@ import {
STEP_TYPE_TO_CHANNEL_TYPE,
} from '@novu/shared';

import { PinoLogger } from '../../logging';
import { Instrument, InstrumentUsecase } from '../../instrumentation';

import {
AnalyticsService,
buildNotificationTemplateIdentifierKey,
CachedEntity,
EventsPerformanceService,
} from '../../services';
import { TriggerEventCommand } from './trigger-event.command';
import {
StoreSubscriberJobs,
StoreSubscriberJobsCommand,
} from '../store-subscriber-jobs';

import {
CreateNotificationJobsCommand,
CreateNotificationJobs,
Expand All @@ -36,6 +24,20 @@ import {
ProcessSubscriber,
ProcessSubscriberCommand,
} from '../process-subscriber';
import {
StoreSubscriberJobs,
StoreSubscriberJobsCommand,
} from '../store-subscriber-jobs';

import { PinoLogger } from '../../logging';
import { Instrument, InstrumentUsecase } from '../../instrumentation';

import {
AnalyticsService,
buildNotificationTemplateIdentifierKey,
CachedEntity,
EventsPerformanceService,
} from '../../services';
import { ApiException } from '../../utils/exceptions';

const LOG_CONTEXT = 'TriggerEventUseCase';
Expand Down Expand Up @@ -167,6 +169,20 @@ export class TriggerEvent {
organizationId: command.organizationId,
});
await this.storeSubscriberJobs.execute(storeSubscriberJobsCommand);
} else {
/**
* TODO: Potentially add a CreateExecutionDetails entry. Right now we
* have the limitation we need a job to be created for that. Here there
* is no job at this point.
*/
Logger.warn(
`Subscriber ${JSON.stringify(subscriber._id)} of organization ${
command.organizationId
} in transaction ${
command.transactionId
} was not processed. No jobs are created.`,
LOG_CONTEXT
);
}
}

Expand Down