Skip to content

ref: fix re-assignment from 4-ary QuerySet to 2-ary list of tuples #75152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2024
Merged
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
8 changes: 4 additions & 4 deletions src/sentry/tasks/embeddings_grouping/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_current_batch_groups_from_postgres(
if last_processed_group_id is not None:
group_id_filter = Q(id__lt=last_processed_group_id)

groups_to_backfill_batch = (
groups_to_backfill_batch_raw = (
Group.objects.filter(
group_id_filter,
project_id=project.id,
Expand All @@ -132,17 +132,17 @@ def get_current_batch_groups_from_postgres(
.values_list("id", "data", "status", "last_seen")
.order_by("-id")[:batch_size]
)
total_groups_to_backfill_length = len(groups_to_backfill_batch)
total_groups_to_backfill_length = len(groups_to_backfill_batch_raw)
batch_end_group_id = (
groups_to_backfill_batch[total_groups_to_backfill_length - 1][0]
groups_to_backfill_batch_raw[total_groups_to_backfill_length - 1][0]
if total_groups_to_backfill_length
else None
)

# Filter out groups that are pending deletion in memory so postgres won't make a bad query plan
groups_to_backfill_batch = [
(group[0], group[1])
for group in groups_to_backfill_batch
for group in groups_to_backfill_batch_raw
if group[2] not in [GroupStatus.PENDING_DELETION, GroupStatus.DELETION_IN_PROGRESS]
and group[3] > datetime.now(UTC) - timedelta(days=90)
]
Expand Down
Loading