mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
DEV: improve missing uploads query and skip checking file size
This commit is contained in:
parent
593cd831e1
commit
bcdf5b2f47
@ -128,7 +128,7 @@ module FileStore
|
||||
verified_ids = []
|
||||
|
||||
files.each do |f|
|
||||
id = model.where("url LIKE '%#{f.key}' AND filesize = #{f.size}").pluck(:id).first
|
||||
id = model.where("url LIKE '%#{f.key}'").pluck(:id).first if f.size > 0
|
||||
verified_ids << id if id.present?
|
||||
marker = f.key
|
||||
end
|
||||
@ -138,7 +138,7 @@ module FileStore
|
||||
files = @s3_helper.list(prefix, marker)
|
||||
end
|
||||
|
||||
missing_uploads = model.joins('LEFT JOIN verified_ids ON val = id').where(val: nil)
|
||||
missing_uploads = model.where("id NOT IN (SELECT val FROM verified_ids)")
|
||||
missing_count = missing_uploads.count
|
||||
|
||||
if missing_count > 0
|
||||
|
Loading…
Reference in New Issue
Block a user