Skip to content

Commit

Permalink
bundle analysis: fix slow trend query (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
JerrySentry authored Sep 10, 2024
1 parent 4055e66 commit e8d8cd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions graphql_api/actions/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ def measurements_by_ids(


def measurements_last_uploaded_before_start_date(
owner_id: int,
repo_id: int,
measurable_name: str,
measurable_ids: List[int],
measurable_id: int,
start_date: datetime,
branch: Optional[str] = None,
) -> QuerySet:
queryset = Measurement.objects.filter(
owner_id=owner_id,
repo_id=repo_id,
measurable_id__in=measurable_ids,
measurable_id=measurable_id,
name=measurable_name,
timestamp__lt=start_date,
)
Expand Down
3 changes: 2 additions & 1 deletion services/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,10 @@ def _compute_measurements(
for measurable_id, measurements in all_measurements.items():
if self.after is not None and measurements[0]["timestamp_bin"] > self.after:
carryover_measurement = measurements_last_uploaded_before_start_date(
owner_id=self.repository.author.ownerid,
repo_id=self.repository.repoid,
measurable_name=measurable_name,
measurable_ids=[measurable_id],
measurable_id=measurable_id,
start_date=self.after,
branch=self.branch,
)
Expand Down

0 comments on commit e8d8cd0

Please sign in to comment.