-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: batch or partition DB access and commits for user streak updation #3296
Conversation
I think the current implementation could be implemented with two update statements (which would be more efficient than the loops):
I think there was a logic error in the current code which causes the streak_days count to become too low after a some time. After incrementing it sets the streak_last_day_date = current_time .. but in this case it is clear that (current_time-streak_last_day_date) > 24h .. that means it takes >24h before each streak increment .. the effect depends on the update interval .. but let's say it is 4 hours than in the worst case it could mean a streak is incremented only all 28h .. IMO one big problem with the current logic is: It always updates the streak_last_day_date of all users .. especially of all inactive users... maybe the whole streak-update mechanisms should be redesigned? |
To summarise the changes
|
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.
Looks good now to me!
fixes #3293
What is the best USER_STREAK_BATCH_SIZE ?