mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Split queries when cleaning uploads.
This reduces the number of scans that the db has to do in the query to fetch orphan uploads. Futheremore, we were not batching our records which bloats memory.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
Fabricator(:upload) do
|
||||
user
|
||||
sha1 "e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98"
|
||||
sha1 { sequence(:sha1) { |n| Digest::SHA1.hexdigest(n.to_s) } }
|
||||
original_filename "logo.png"
|
||||
filesize 1234
|
||||
width 100
|
||||
height 200
|
||||
url "/uploads/default/1/1234567890123456.png"
|
||||
url { sequence(:url) { |n| "/uploads/default/#{n}/1234567890123456.png" } }
|
||||
end
|
||||
|
||||
Fabricator(:attachment, from: :upload) do
|
||||
|
||||
3
spec/fabricators/user_avatar_fabricator.rb
Normal file
3
spec/fabricators/user_avatar_fabricator.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
Fabricator(:user_avatar) do
|
||||
user
|
||||
end
|
||||
Reference in New Issue
Block a user