diff --git a/app/jobs/update_external_cache_job.rb b/app/jobs/update_external_cache_job.rb index a4c98cc..c53a06a 100644 --- a/app/jobs/update_external_cache_job.rb +++ b/app/jobs/update_external_cache_job.rb @@ -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 diff --git a/app/models/external_api_image.rb b/app/models/external_api_image.rb index c0d326c..fdd544c 100644 --- a/app/models/external_api_image.rb +++ b/app/models/external_api_image.rb @@ -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!