Skip to content

Commit c29cf1c

Browse files
committed
Removed the isEventIgnored method as its functionality is now integrated directly into the task addition logic.
1 parent 00c633f commit c29cf1c

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

workers/grouper/src/index.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ export default class GrouperWorker extends Worker {
235235
* Add task for NotifierWorker only if event is not ignored
236236
*/
237237
if (process.env.IS_NOTIFIER_WORKER_ENABLED) {
238-
const isIgnored = await this.isEventIgnored(task.projectId, uniqueEventHash);
238+
const isIgnored = isFirstOccurrence
239+
? false
240+
: !!(existedEvent as GroupedEventDBScheme & { marks?: { ignored?: boolean } })?.marks
241+
?.ignored;
239242

240243
if (!isIgnored) {
241244
await this.addTask(WorkerNames.NOTIFIER, {
@@ -664,27 +667,4 @@ export default class GrouperWorker extends Worker {
664667

665668
return eventDate.getTime() / MS_IN_SEC;
666669
}
667-
668-
/**
669-
* Check if event is marked as ignored
670-
*
671-
* @param {string} projectId - project id
672-
* @param {string} groupHash - event group hash
673-
* @returns {Promise<boolean>} - true if event is ignored, false otherwise
674-
*/
675-
private async isEventIgnored(projectId: string, groupHash: string): Promise<boolean> {
676-
try {
677-
const eventsCollection = this.eventsDb.getConnection().collection(`events:${projectId}`);
678-
679-
const event = await eventsCollection.findOne(
680-
{ groupHash },
681-
{ projection: { 'marks.ignored': 1 } }
682-
);
683-
684-
return !!event?.marks?.ignored;
685-
} catch (e) {
686-
this.logger.warn(`Failed to check if event ${groupHash} is ignored: ${e}`);
687-
return false; // If we can't check, don't block notifications
688-
}
689-
}
690670
}

0 commit comments

Comments
 (0)