chore(image): ignore invalid images files / formats
This commit is contained in:
parent
e95e86faae
commit
2656ec18af
1 changed files with 5 additions and 5 deletions
|
@ -14,6 +14,10 @@ class ImageProcessorJob < ApplicationJob
|
||||||
# (to avoid modifying the file while it is being scanned).
|
# (to avoid modifying the file while it is being scanned).
|
||||||
retry_on FileNotScannedYetError, wait: :exponentially_longer, attempts: 10
|
retry_on FileNotScannedYetError, wait: :exponentially_longer, attempts: 10
|
||||||
|
|
||||||
|
# Usually invalid image or ImageMagick decoder blocked for this format
|
||||||
|
retry_on MiniMagick::Invalid, attempts: 3
|
||||||
|
retry_on MiniMagick::Error, attempts: 3
|
||||||
|
|
||||||
rescue_from ActiveStorage::PreviewError do
|
rescue_from ActiveStorage::PreviewError do
|
||||||
retry_or_discard
|
retry_or_discard
|
||||||
end
|
end
|
||||||
|
@ -82,12 +86,8 @@ class ImageProcessorJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def retry_or_discard
|
def retry_or_discard
|
||||||
if executions < max_attempts
|
if executions < 3
|
||||||
retry_job wait: 5.minutes
|
retry_job wait: 5.minutes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_attempts
|
|
||||||
3
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue