gitlab-org--gitlab-foss/app/models/concerns
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
..
mentionable
storage
access_requestable.rb
artifact_migratable.rb
atomic_internal_id.rb
avatarable.rb Fix an N+1 in avatar URLs 2018-06-05 14:57:19 +01:00
awardable.rb
batch_destroy_dependent_associations.rb Fix project destruction failing due to idle in transaction timeouts 2018-05-24 16:40:02 -07:00
blob_like.rb
blocks_json_serialization.rb
bulk_member_access_load.rb
cache_markdown_field.rb
cacheable_attributes.rb Use RequestStore in CacheableAttributes.cached for greater performance 2018-06-01 14:01:27 +02:00
case_sensitivity.rb
chronic_duration_attribute.rb
created_at_filterable.rb
deployment_platform.rb
diff_file.rb Persist truncated note diffs on a new table 2018-05-24 15:34:43 -03:00
discussion_on_diff.rb
each_batch.rb
editable.rb
expirable.rb
fast_destroy_all.rb
faster_cache_keys.rb
feature_gate.rb
ghost_user.rb
group_descendant.rb
has_status.rb
has_variable.rb Upgrade to Ruby 2.4.4 2018-05-29 15:19:33 -07:00
ignorable_column.rb
iid_routes.rb
importable.rb
issuable.rb Ensure metrics regardless of being imported on MRs 2018-05-30 12:14:56 -03:00
loaded_in_group_list.rb
manual_inverse_association.rb
mentionable.rb
milestoneish.rb
note_on_diff.rb
noteable.rb
participable.rb
presentable.rb
project_features_compatibility.rb Removed API endpoint and specs 2018-05-30 18:23:07 +02:00
prometheus_adapter.rb
protected_branch_access.rb
protected_ref.rb
protected_ref_access.rb
protected_tag_access.rb
reactive_caching.rb ReactiveCaching#clear_reactive_cache! should clear the not keep the cache alive 2018-06-01 14:35:49 +01:00
reactive_service.rb
redis_cacheable.rb
referable.rb
relative_positioning.rb
resolvable_discussion.rb
resolvable_note.rb Check if note's noteable is not nil when checking resolvability 2018-05-23 16:58:40 +02:00
routable.rb
select_for_project_authorization.rb
sha_attribute.rb
sortable.rb
spammable.rb
strip_attribute.rb
subscribable.rb
taskable.rb
throttled_touch.rb
time_trackable.rb Resolve "Update updated_at on an issue/mr on every issue/mr changes" 2018-06-01 15:09:08 +00:00
token_authenticatable.rb
triggerable_hooks.rb
uniquify.rb
updated_at_filterable.rb
valid_attribute.rb
with_uploads.rb Fix an N+1 in avatar URLs 2018-06-05 14:57:19 +01:00