prevent a single image queuing 10+ jobs
This commit is contained in:
parent
023af6527f
commit
41177bc37a
@ -4,7 +4,6 @@ class UpdateExternalCacheJob < ApplicationJob
|
||||
queue_as :cache
|
||||
|
||||
def perform(image)
|
||||
return unless image.cache_expired? || image.cached_data.blank?
|
||||
image.update_cache!
|
||||
end
|
||||
end
|
||||
|
@ -145,7 +145,9 @@ class ExternalAPIImage < ApplicationRecord
|
||||
end
|
||||
|
||||
def update_cache
|
||||
return if @cache_updated
|
||||
UpdateExternalCacheJob.perform_later(self)
|
||||
@cache_updated = true
|
||||
end
|
||||
|
||||
def update_cache!
|
||||
|
Loading…
Reference in New Issue
Block a user