I am converting a large CarrierWave storage to Shrine and am trying to track down a random issue.
My conversion code looks like this…
I have an Attachment class with a Carrierwave uploader and Shrine attacher on the
# pull the carrierwave file from storage to cache cw = a.file cw.cache_stored_file! # upload to Shrine a.file_attacher.assign File.open(cw.tmp_cache_path, "rb") a.save
This code works great, however as a quality check, I am scanning all records to ensure that the files exist, are the correct size, and are stored in the storage. I am finding some random cases…
Attachment.find_each do |a| if a.cached? and !a.stored? raise "attachment is cached but not stored" end end
In some random cases,
false. The file does not get processed into storage.
Question - why does the …file_attacher.assign(…) not return some error status if the file does not make it all of the way to storage? Or maybe it does - does anyone have suggestions about how to handle this error scenario? Thanks!