Skip to content

Commit

Permalink
fix(issue summary): Skip summary cache if event id provided (#81851)
Browse files Browse the repository at this point in the history
In order for users to be able to refresh the summary for a specific
event they choose, we need to skip the cache if a specific event is
provided.
  • Loading branch information
roaga authored Dec 7, 2024
1 parent b70cbd7 commit b6b62df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sentry/api/endpoints/group_ai_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ def post(self, request: Request, group: Group) -> Response:
):
return Response({"detail": "Feature flag not enabled"}, status=400)

cache_key = "ai-group-summary-v2:" + str(group.id)
if cached_summary := cache.get(cache_key):
return Response(convert_dict_key_case(cached_summary, snake_to_camel_case), status=200)

data = orjson.loads(request.body) if request.body else {}
force_event_id = data.get("event_id", None)

cache_key = "ai-group-summary-v2:" + str(group.id)
if not force_event_id and (cached_summary := cache.get(cache_key)):
return Response(convert_dict_key_case(cached_summary, snake_to_camel_case), status=200)

serialized_event, event = self._get_event(
group, request.user, provided_event_id=force_event_id
)
Expand Down

0 comments on commit b6b62df

Please sign in to comment.