Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Mar 15, 2024
2 parents f2d74b2 + c87dd1b commit b164936
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions eagleproject/notify/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,22 @@ def seen_filter(events):

events_parsed.append(event_hash)

_, created = EventSeen.objects.get_or_create(
event_hash=event_hash,
last_seen__gt=datetime.now(tz=timezone.utc) - ev.deduplicate_time_window,
defaults={
'event_hash': event_hash,
'last_seen': datetime.now(tz=timezone.utc)
}
)

if not created:
# Do not send duplicate alert within the defined time window
continue
try:
_, created = EventSeen.objects.get_or_create(
event_hash=event_hash,
last_seen__gt=datetime.now(tz=timezone.utc) - ev.deduplicate_time_window,
defaults={
'event_hash': event_hash,
'last_seen': datetime.now(tz=timezone.utc)
}
)

if not created:
# Do not send duplicate alert within the defined time window
continue

except:
print("Failed to apply seen filter")

filtered.append(ev)

Expand Down

0 comments on commit b164936

Please sign in to comment.