Skip to content
Snippets Groups Projects
  1. Jul 26, 2018
  2. Jun 05, 2018
    • Sean McGivern's avatar
      Fix an N+1 in avatar URLs · 6ecf819f
      Sean McGivern authored
      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.
      6ecf819f
  3. Jun 03, 2016
  4. May 09, 2016
  5. May 06, 2016
  6. Mar 05, 2016
  7. Oct 09, 2014
  8. Apr 09, 2014
  9. Aug 21, 2013
  10. Jun 19, 2013
  11. Mar 24, 2013
  12. Feb 05, 2013
  13. Jan 05, 2013
  14. Jan 04, 2013
  15. Nov 19, 2012
  16. Oct 09, 2012
  17. Sep 26, 2012
  18. Sep 02, 2012
  19. Aug 29, 2012
  20. Aug 10, 2012
  21. Aug 02, 2012
  22. Jun 26, 2012
  23. May 26, 2012
  24. May 10, 2012
  25. Feb 15, 2012
Loading