Remove unused prefetch_related in metrics task (#2343)

The `prefecth_related` data here is not being used later (since we are
applying filters not getting `.all`) and it is preloading all alert
groups for integrations into memory (which can be a lot).
This commit is contained in:
Matias Bordese 2023-06-26 11:12:10 -03:00 committed by GitHub
parent 460a2826e1
commit f4eb2bbf2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,6 @@ def calculate_and_cache_metrics(organization_id, force=False):
AlertReceiveChannel.objects.using(get_random_readonly_database_key_if_present_otherwise_default())
.filter(~Q(integration=AlertReceiveChannel.INTEGRATION_MAINTENANCE) & Q(organization_id=organization_id))
.select_related("organization", "team")
.prefetch_related("alert_groups")
)
response_time_period = get_response_time_period()