Skip to content

Commit a7243f3

Browse files
getsentry-botroaga
andcommitted
Revert "fix(issue summary): Close database connections after issue summary generation (#97555)"
This reverts commit 4df4193. Co-authored-by: roaga <[email protected]>
1 parent 5cd6591 commit a7243f3

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/sentry/integrations/utils/issue_summary_for_alerts.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Any
44

55
import sentry_sdk
6-
from django.db import close_old_connections
76

87
from sentry import features, options
98
from sentry.issues.grouptype import GroupCategory
@@ -16,19 +15,6 @@
1615
logger = logging.getLogger(__name__)
1716

1817

19-
def _get_issue_summary_with_cleanup(
20-
group: Group, source: SeerAutomationSource
21-
) -> tuple[dict[str, Any], int]:
22-
"""
23-
Wrapper for get_issue_summary that ensures database connections are properly closed.
24-
This is needed when running in a thread to prevent connection leaks.
25-
"""
26-
try:
27-
return get_issue_summary(group, source=source)
28-
finally:
29-
close_old_connections()
30-
31-
3218
def fetch_issue_summary(group: Group) -> dict[str, Any] | None:
3319
"""
3420
Try to fetch an issue summary with a timeout of 5 seconds.
@@ -66,7 +52,7 @@ def fetch_issue_summary(group: Group) -> dict[str, Any] | None:
6652
with sentry_sdk.start_span(op="ai_summary.fetch_issue_summary_for_alert"):
6753
with concurrent.futures.ThreadPoolExecutor() as executor:
6854
future = executor.submit(
69-
_get_issue_summary_with_cleanup, group, SeerAutomationSource.ALERT
55+
get_issue_summary, group, source=SeerAutomationSource.ALERT
7056
)
7157
summary_result, status_code = future.result(timeout=timeout)
7258

0 commit comments

Comments
 (0)