Fix uploads getting stuck in 'processing' state (fix #3659).
Bug: if an upload timed out while downloading the file, Upload#process! would catch the error and attempt to retry, but since the upload was already in the 'processing' state, on the second try `process!` would bail out immediately and leave the upload stuck in the 'processing' state. Fix: remove the retry logic from Upload#process!. Let Downloads::File#download! (which had its own retry logic) handle it instead.
This commit is contained in:
@@ -165,25 +165,11 @@ class Upload < ApplicationRecord
|
||||
end
|
||||
|
||||
def process!(force = false)
|
||||
@tries ||= 0
|
||||
return if !force && status =~ /processing|completed|error/
|
||||
|
||||
process_upload
|
||||
post = create_post_from_upload
|
||||
|
||||
rescue Timeout::Error, Net::HTTP::Persistent::Error => x
|
||||
if @tries > 3
|
||||
update_attributes(:status => "error: #{x.class} - #{x.message}", :backtrace => x.backtrace.join("\n"))
|
||||
else
|
||||
@tries += 1
|
||||
retry
|
||||
end
|
||||
nil
|
||||
|
||||
rescue Exception => x
|
||||
update_attributes(:status => "error: #{x.class} - #{x.message}", :backtrace => x.backtrace.join("\n"))
|
||||
nil
|
||||
|
||||
ensure
|
||||
file.try(:close!)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user