Skip to content

Commit

Permalink
Only call enqueuer if feature enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Jul 23, 2024
1 parent 2546267 commit 360de40
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/domain/hooks/hooks.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
export class HooksRepository implements IHooksRepository {
private static readonly HOOK_TYPE = 'hook';
private readonly queueName: string;
private readonly isPushNotificationsEnabled: boolean;

constructor(
@Inject(IBalancesRepository)
Expand Down Expand Up @@ -67,6 +68,10 @@ export class HooksRepository implements IHooksRepository {
private readonly notificationsRepository: INotificationsRepositoryV2,
) {
this.queueName = this.configurationService.getOrThrow<string>('amqp.queue');
this.isPushNotificationsEnabled =
this.configurationService.getOrThrow<boolean>(
'features.pushNotifications',
);
}

onModuleInit(): Promise<void> {
Expand All @@ -87,7 +92,9 @@ export class HooksRepository implements IHooksRepository {
async onEvent(event: Event): Promise<unknown> {
return Promise.allSettled([
this.onEventClearCache(event),
this.onEventEnqueueNotifications(event),
...(this.isPushNotificationsEnabled
? [this.onEventEnqueueNotifications(event)]
: []),
]).finally(() => {
this.onEventLog(event);
});
Expand Down

0 comments on commit 360de40

Please sign in to comment.