Skip to content

Commit a3c4a73

Browse files
authored
fix: only added topic (#3365)
1 parent 3b7517c commit a3c4a73

3 files changed

Lines changed: 3 additions & 10 deletions

File tree

__tests__/workers/cdc/primary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6917,10 +6917,10 @@ describe('organization', () => {
69176917

69186918
expect(triggerTypedEvent).toHaveBeenCalledTimes(2);
69196919
expect(jest.mocked(triggerTypedEvent).mock.calls[0][1]).toEqual(
6920-
'api.v1.opportunity-updated',
6920+
'api.v1.opportunity-added',
69216921
);
69226922
expect(jest.mocked(triggerTypedEvent).mock.calls[1][1]).toEqual(
6923-
'api.v1.opportunity-updated',
6923+
'api.v1.opportunity-added',
69246924
);
69256925
});
69266926

src/common/opportunity/pubsub.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,10 @@ export const notifyJobOpportunity = async ({
334334
con,
335335
logger,
336336
opportunityId,
337-
isUpdate = false,
338337
}: {
339338
con: DataSource;
340339
logger: FastifyBaseLogger;
341340
opportunityId: string;
342-
isUpdate?: boolean;
343341
}) => {
344342
const [opportunity, organization, keywords, users, locations] =
345343
await queryReadReplica(con, async ({ queryRunner }) => {
@@ -458,11 +456,8 @@ export const notifyJobOpportunity = async ({
458456
excludedUserIds,
459457
});
460458

461-
const topicName = isUpdate
462-
? 'api.v1.opportunity-updated'
463-
: 'api.v1.opportunity-added';
464459
try {
465-
await triggerTypedEvent(logger, topicName, message);
460+
await triggerTypedEvent(logger, 'api.v1.opportunity-added', message);
466461
} catch (_err) {
467462
const err = _err as Error;
468463
logger.error({ err, message }, 'failed to send opportunity event');

src/workers/cdc/primary.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,6 @@ const onOpportunityChange = async (
13881388
con,
13891389
logger,
13901390
opportunityId: data.payload.after!.id,
1391-
isUpdate: true,
13921391
});
13931392
if (data.payload.after?.state !== OpportunityState.LIVE) {
13941393
await con
@@ -1447,7 +1446,6 @@ const onOrganizationChange = async (
14471446
con,
14481447
logger,
14491448
opportunityId: opportunity.id,
1450-
isUpdate: true,
14511449
});
14521450
}),
14531451
);

0 commit comments

Comments
 (0)