mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 19:03:13 +08:00
bd07658a37
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.
18 lines
412 B
Ruby
18 lines
412 B
Ruby
Fabricator(:upload) do
|
|
user
|
|
sha1 { sequence(:sha1) { |n| Digest::SHA1.hexdigest(n.to_s) } }
|
|
original_filename "logo.png"
|
|
filesize 1234
|
|
width 100
|
|
height 200
|
|
url { sequence(:url) { |n| "/uploads/default/#{n}/1234567890123456.png" } }
|
|
end
|
|
|
|
Fabricator(:attachment, from: :upload) do
|
|
id 42
|
|
user
|
|
original_filename "archive.zip"
|
|
filesize 1234
|
|
url "/uploads/default/42/66b3ed1503efc936.zip"
|
|
end
|