Skip to content

Commit

Permalink
ref: fix more types in tasks (#73581)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry committed Jul 1, 2024
1 parent eaa6690 commit fe8da9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/sentry/tasks/collect_project_platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def collect_project_platforms(paginate=1000, **kwargs):
)

for platform, project_id in queryset:
if platform is None:
continue
platform = platform.lower()
if platform not in VALID_PLATFORMS:
continue
Expand Down
7 changes: 4 additions & 3 deletions src/sentry/tasks/summaries/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def user_project_ownership(ctx: OrganizationReportContext) -> None:
for project_id, user_id in OrganizationMember.objects.filter(
organization_id=ctx.organization.id, teams__projectteam__project__isnull=False
).values_list("teams__projectteam__project_id", "user_id"):
ctx.project_ownership.setdefault(user_id, set()).add(project_id)
if user_id is not None:
ctx.project_ownership.setdefault(user_id, set()).add(project_id)


def project_key_errors(
Expand Down Expand Up @@ -236,7 +237,7 @@ def project_key_performance_issues(ctx: OrganizationReportContext, project: Proj
# Pick the 50 top frequent performance issues last seen within a month with the highest event count from all time.
# Then, we use this to join with snuba, hoping that the top 3 issue by volume counted in snuba would be within this list.
# We do this to limit the number of group_ids snuba has to join with.
groups = Group.objects.filter(
groups_qs = Group.objects.filter(
project_id=project.id,
status=GroupStatus.UNRESOLVED,
last_seen__gte=ctx.end - timedelta(days=30),
Expand All @@ -246,7 +247,7 @@ def project_key_performance_issues(ctx: OrganizationReportContext, project: Proj
).order_by("-times_seen")[:50]

# Django doesn't have a .limit function, and this will actually do its magic to use the LIMIT statement.
groups = list(groups)
groups = list(groups_qs)
group_id_to_group = {group.id: group for group in groups}

if len(group_id_to_group) == 0:
Expand Down

0 comments on commit fe8da9b

Please sign in to comment.