Remove unnecessary DB access from statistic_during_period (#82871)

This commit is contained in:
Erik Montnemery
2022-11-28 19:48:06 +01:00
committed by GitHub
parent a038314d8b
commit 58b3a00b16

View File

@@ -1502,13 +1502,6 @@ def statistic_during_period(
main_start_time = start_time if head_end_time is None else head_end_time main_start_time = start_time if head_end_time is None else head_end_time
main_end_time = end_time if tail_start_time is None else tail_start_time main_end_time = end_time if tail_start_time is None else tail_start_time
# Fetch metadata for the given statistic_id
metadata = get_metadata_with_session(session, statistic_ids=[statistic_id])
if not metadata:
return result
metadata_id = metadata[statistic_id][0]
if not types.isdisjoint({"max", "mean", "min"}): if not types.isdisjoint({"max", "mean", "min"}):
result = _get_max_mean_min_statistic( result = _get_max_mean_min_statistic(
session, session,