Commit Graph

8 Commits

Author SHA1 Message Date
Micaël Bergeron 3d42bab71a
apply feedback 2018-06-12 11:22:35 -04:00
Micaël Bergeron e1589a5c58
apply feedback 2018-06-08 10:51:59 -04:00
Micaël Bergeron 44975f8a5a
shave off another 20% query 2018-06-07 10:01:47 -04:00
Micaël Bergeron 38c2e480bf
shave off 30% of the query count 2018-06-06 16:45:42 -04:00
Sean McGivern 6ecf819f73 Fix an N+1 in avatar URLs
This is tricky: the query was being run in
`ObjectStorage::Extension::RecordsUploads#retrieve_from_store!`, but we can't
just add batch loading there, because the `#upload=` method there would use the
result immediately, making the batch only have one item.

Instead, we can pre-emptively add an item to the batch whenever an avatarable
object is initialized, and then reuse that batch item in
`#retrieve_from_store!`. However, this also has problems:

1. There is a lot of logic in `Avatarable#retrieve_upload_from_batch`.
2. Some of that logic constructs a 'fake' model for the batch key. This should
   be fine, because of ActiveRecord's override of `#==`, but it relies on that
   staying the same.
2018-06-05 14:57:19 +01:00
Micaël Bergeron fdfc20c3ff apply feedback 2018-05-09 19:57:08 +00:00
Micaël Bergeron 59d3e84f0a remove the `Upload` redefinition in `MigrateUploadsWorker` 2018-05-08 10:04:52 -04:00
Micaël Bergeron 10cc6cb56f backport missing object storage worker specs 2018-04-02 15:28:56 -04:00