From 5a534b4bfa020504dadab27cf75647917796426a Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Fri, 16 Aug 2024 11:52:13 -0700 Subject: [PATCH] use helper to get grouphashes --- src/sentry/event_manager.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/sentry/event_manager.py b/src/sentry/event_manager.py index 4a8152e49d0a9c..84f431ed16f826 100644 --- a/src/sentry/event_manager.py +++ b/src/sentry/event_manager.py @@ -62,6 +62,7 @@ find_existing_grouphash, find_existing_grouphash_new, get_hash_values, + get_or_create_grouphashes, maybe_run_background_grouping, maybe_run_secondary_grouping, run_primary_grouping, @@ -1420,9 +1421,7 @@ def _save_aggregate( and not primary_hashes.hierarchical_hashes ) - flat_grouphashes = [ - GroupHash.objects.get_or_create(project=project, hash=hash)[0] for hash in hashes.hashes - ] + flat_grouphashes = get_or_create_grouphashes(project, hashes) # The root_hierarchical_hash is the least specific hash within the tree, so # typically hierarchical_hashes[0], unless a hash `n` has been split in @@ -1788,10 +1787,7 @@ def get_hashes_and_grouphashes( grouping_config, hashes = hash_calculation_function(project, job, metric_tags) if extract_hashes(hashes): - grouphashes = [ - GroupHash.objects.get_or_create(project=project, hash=hash)[0] - for hash in extract_hashes(hashes) - ] + grouphashes = get_or_create_grouphashes(project, hashes) existing_grouphash = find_existing_grouphash_new(grouphashes)