ec85debaf5
With object storage enabled, calling `#filename` on an upload does this: 1. Call the `#filename` method on the CarrierWave object. 2. Generate the URL for that object. 3. If the uploader isn't public, do so by generating an authenticated URL, including signing that request. That's all correct behaviour, but for the case where we use `#filename`, it's typically to generate a GitLab URL. That URL doesn't need to be signed because we do our own auth. Signing the URLs can be very expensive, especially in batch (say, we need to get the avatar URLs for 150 users in one request). It's all unnecessary work. If we used the `RecordsUploads` concern, we have already recorded a `path` in the database. That `path` is actually generated from CarrierWave's `#filename` at upload time, so we don't need to recompute it - we can just use it and strip off the prefix if it's available. On a sample users autocomplete URL, at least 10% of the time before this change went to signing URLs. After this change, we spend no time in URL signing, and still get the correct results. |
||
---|---|---|
.. | ||
attachment_uploader.rb | ||
avatar_uploader.rb | ||
external_diff_uploader.rb | ||
favicon_uploader.rb | ||
file_mover.rb | ||
file_uploader.rb | ||
gitlab_uploader.rb | ||
import_export_uploader.rb | ||
job_artifact_uploader.rb | ||
legacy_artifact_uploader.rb | ||
lfs_object_uploader.rb | ||
namespace_file_uploader.rb | ||
object_storage.rb | ||
personal_file_uploader.rb | ||
records_uploads.rb | ||
uploader_helper.rb | ||
workhorse.rb |