-
Notifications
You must be signed in to change notification settings - Fork 113
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
Remove end_date on play count challenge and update query #11563
Conversation
|
@@ -38,7 +37,7 @@ def _get_user_play_count_2025(self, session: Session, user_id: int) -> int: | |||
Track.is_delete == False, | |||
), | |||
) | |||
.filter(and_(Play.created_at >= start_date, Play.created_at < end_date)) | |||
.filter(Play.created_at >= start_date) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm worried about this being slow. it is a very very hot path. like will run every time a single play event happens.
this query would be a lot faster if we ran it against the aggregate_monthly_plays
table.
select count("plays"."id") from "plays"
join "tracks"
on "tracks"."track_id" = "plays"."play_item_id"
where "tracks"."owner_id" = 1
Ran for > 1 minute. No results on prod data.
select sum("count") from "aggregate_monthly_plays"
where "play_item_id" in (select "track_id" from "tracks" where "owner_id" = 1)
and "timestamp" > '2025-01-01'
300ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: it took 1 minute 51 sec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree - one downside tho is that if aggregate_plays
is behind on one node for some reason, we might get inconsistencies between DNs.
but that's probably the tradeoff we have to live with.. since many plays should be coming in eventually they should end up in the same state.
* origin/main: Remove prop in PlayCountMilestoneContent causing type error (#11575) dual write to acdc and core (#11573) [C-5828] Fix useQueries default loading state (#11569) fix attest endpoint (#11552) Fix unlocked gated content section on web (#11568) Remove end_date on play count challenge and update query (#11563)
[4a0e8cc] dual write to acdc and core (#11573) alecsavvy [2f859fb] fix attest endpoint (#11552) Steve Perkins [6fc5376] Remove end_date on play count challenge and update query (#11563) Farid Salau [5bebab8] [PAY-3893][PAY-3894] Remove legacy indexing of associated_wallets and collectibles (#11564) Randy Schott [00a19f0] Fix marshalling for playlist notifs (#11562) Randy Schott [ba9b8fb] Delete pc challenge (#11561) Farid Salau [84eb2f8] [PAY-3979][PAY-3990] Update play count challenge BE and Add the FE (#11521) Farid Salau
Description
We are limiting earnings for play count from 2025 and beyond. Removing the
end_date
constraint so users can earn the reward post 2025.How Has This Been Tested?