Skip to content

Commit ed1dbfc

Browse files
Report server: Reduce duplicate search window to prevent timeout (#567)
1 parent 5dac09e commit ed1dbfc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tagbot/web/reports.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import re
44

5+
from datetime import datetime, timedelta, timezone
56
from typing import Dict, Optional
67

78
import boto3
@@ -118,9 +119,13 @@ def _is_duplicate(a: str, b: str) -> bool:
118119
return ratio < 0.1
119120

120121

122+
_DUPLICATE_SEARCH_WINDOW = timedelta(days=60)
123+
124+
121125
def _find_duplicate(stacktrace: str) -> Optional[Issue]:
122-
"""Look for a duplicate error report."""
123-
for issue in _get_issues_repo().get_issues(state="all"):
126+
"""Look for a duplicate error report updated within the search window."""
127+
since = datetime.now(timezone.utc) - _DUPLICATE_SEARCH_WINDOW
128+
for issue in _get_issues_repo().get_issues(state="all", since=since):
124129
m = re.search("(?s)```py\n(.*)\n```", issue.body)
125130
if not m:
126131
continue

0 commit comments

Comments
 (0)