tjcsl / ion

TJ Intranet 3
https://ion.tjhsst.edu
GNU General Public License v2.0
99 stars 91 forks source link

refactor fetch_activity_list_with_metadata to avoid race condition #426

Closed pefoley2 closed 8 years ago

pefoley2 commented 8 years ago

See https://github.com/tjcsl/ion/blob/master/intranet/apps/eighth/serializers.py#L124 The mix of database queries and python data manipulation is most likely responsible for the sporadic errors that occur during heavy load.

pefoley2 commented 8 years ago

A possible solution would be to have activity_list and scheduled_activity_to_activity_map fall back to querying the db, if an indexerror would otherwise be raised.

pefoley2 commented 8 years ago

collections.defaultdict would be useful.