Просмотр исходного кода

Maintenance: Run cache cleanup only if possible.

Rolf Schmidt 2 лет назад
Родитель
Сommit
281a9d7684
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      app/jobs/cache_clear_job.rb

+ 3 - 1
app/jobs/cache_clear_job.rb

@@ -4,7 +4,9 @@ class CacheClearJob < ApplicationJob
   include HasActiveJobLock
 
   def perform
-    Rails.cache.cleanup
+    # cleanup is not supported by every backend so
+    # try only if exists
+    Rails.cache.try(:cleanup)
   rescue => e
     Rails.logger.error "Scheduled cache cleanup failed! #{e.inspect}"
   end