Skip to content
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

Download stats tables get out of sync due to simultaneous requests #21

Open
AlexanderPico opened this issue Apr 14, 2016 · 2 comments
Open
Labels
Projects

Comments

@AlexanderPico
Copy link
Member

In the "download" module of the App Store code base, there should only be one instance of ReleaseDownloadsByDate for each day, and only one instance of AppDownloadsByGeoLoc for each GeoLoc instance. However, if there are multiple requests made at the same time at the beginning of the day, this can cause more than one instance of ReleaseDownloadsByDate to be created. This scenario causes the _increment_count function in download/views.py to fail, preventing anyone from downloading any app for the entire day.

Short term solution:
Fix _increment_count to not use get_or_create() function. Instead, it will retrieve the first instance (at index 0) of ReleaseDownloadsByDate for a given date. This will cause some download numbers to be lost, but won't lead to more catastrophic errors.

Long term solution:
Create an async queue. Updating download stats are pushed onto the async queue, and the download is forwarded immediately to the user. Any catastrophic problem would be pushed to the async queue, and users would be unaffected.

@AdamStuart
Copy link

var/www/CyAppAStore/download/views.py: 25

@AlexanderPico
Copy link
Member Author

Wait until the bug is reproducible on new site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
GSoC 2019
  
To do
Development

No branches or pull requests

3 participants