cytoscape / appstore

Cytoscape App Store web application code
16 stars 20 forks source link

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

Open AlexanderPico opened 8 years ago

AlexanderPico commented 8 years ago

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 commented 8 years ago

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

AlexanderPico commented 5 years ago

Wait until the bug is reproducible on new site.