Skip to content

Commit

Permalink
chg: [notifications] For a new notification, never executed, we set l…
Browse files Browse the repository at this point in the history
…ast_execution_time to one week ago.
cedricbonhomme committed Jan 30, 2025
1 parent 8f565aa commit ca47174
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion website/notifications/notifications.py
Original file line number Diff line number Diff line change
@@ -110,7 +110,6 @@ async def new_vulnerability_report(
for vuln in vulnerabilities[source]
]

# Initialize comments as a defaultdict of lists
comments = defaultdict(list)
sightings = defaultdict(list)

3 changes: 3 additions & 0 deletions website/scripts/notify.py
Original file line number Diff line number Diff line change
@@ -57,6 +57,9 @@ async def find_vulnerabilities(

async def process_notification(notification: Notification) -> int:
"""Processes a single notification and returns its ID if successful."""
# For a new notification, never executed, we set last_execution_time to one week ago.
notification.last_execution_time = notification.last_execution_time or (datetime.now(timezone.utc) - timedelta(days=7))

try:
if vulnerabilities := await find_vulnerabilities(notification):
logger.info(f"New vulnerabilities for: {notification.id}")

0 comments on commit ca47174

Please sign in to comment.