Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/sentry/grouping/ingest/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import TYPE_CHECKING

import sentry_sdk
from django.core.cache import cache

from sentry import options
from sentry.exceptions import HashDiscarded
Expand Down Expand Up @@ -231,7 +232,13 @@ def get_or_create_grouphashes(
hashes = filter(lambda hash_value: hash_value in existing_hashes, hashes)

for hash_value in hashes:
grouphash, created = GroupHash.objects.get_or_create(project=project, hash=hash_value)
cache_key = f"grouphash:{project.id}:{hash_value}"
grouphash = cache.get(cache_key)
created = False

if grouphash is None:
grouphash, created = GroupHash.objects.get_or_create(project=project, hash=hash_value)
cache.set(cache_key, grouphash, timeout=3600)

if options.get("grouping.grouphash_metadata.ingestion_writes_enabled"):
try:
Expand Down
Loading