diff options
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r-- | app/workers/scheduler/indexing_scheduler.rb | 2 | ||||
-rw-r--r-- | app/workers/scheduler/user_cleanup_scheduler.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/app/workers/scheduler/indexing_scheduler.rb b/app/workers/scheduler/indexing_scheduler.rb index 3a6f47a29..c42396629 100644 --- a/app/workers/scheduler/indexing_scheduler.rb +++ b/app/workers/scheduler/indexing_scheduler.rb @@ -7,6 +7,8 @@ class Scheduler::IndexingScheduler sidekiq_options retry: 0 def perform + return unless Chewy.enabled? + indexes.each do |type| with_redis do |redis| ids = redis.smembers("chewy:queue:#{type.name}") diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb index d1f00c47f..7a6995a1f 100644 --- a/app/workers/scheduler/user_cleanup_scheduler.rb +++ b/app/workers/scheduler/user_cleanup_scheduler.rb @@ -15,6 +15,8 @@ class Scheduler::UserCleanupScheduler def clean_unconfirmed_accounts! User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch| + # We have to do it separately because of missing database constraints + AccountModerationNote.where(account_id: batch.map(&:account_id)).delete_all Account.where(id: batch.map(&:account_id)).delete_all User.where(id: batch.map(&:id)).delete_all end |