From 32e37245faaa2a29e6c748c5f4401226fb7662c4 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 17 Aug 2019 15:22:39 -0500 Subject: janitor - allow retries, `@account_ids -> @exclude_ids`, remove unneeded `uniq` calls --- app/workers/scheduler/janitor_scheduler.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/workers/scheduler/janitor_scheduler.rb b/app/workers/scheduler/janitor_scheduler.rb index 4ebed8fa2..06139a82c 100644 --- a/app/workers/scheduler/janitor_scheduler.rb +++ b/app/workers/scheduler/janitor_scheduler.rb @@ -8,15 +8,15 @@ class Scheduler::JanitorScheduler MIN_POSTS = 6 - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options unique: :until_executed def perform @account = janitor_account return if @account.nil? - @exclude_ids = excluded_account_ids.uniq - @exclude_domains = excluded_domains.uniq - @exclude_markov = excluded_accounts_from_env('MARKOV').uniq + @exclude_ids = excluded_account_ids + @exclude_domains = excluded_domains + @exclude_markov = excluded_accounts_from_env('MARKOV') prune_deleted_accounts! suspend_abandoned_accounts! @@ -183,7 +183,7 @@ class Scheduler::JanitorScheduler end def domains_from_account_ids - Account.reorder(nil).where(id: @account_ids).pluck(:domain).uniq + Account.reorder(nil).where(id: @exclude_ids).pluck(:domain).uniq end def local_account_ids @@ -210,10 +210,10 @@ class Scheduler::JanitorScheduler def excluded_accounts_from_env(suffix) excluded_usernames = ENV.fetch("JANITOR_EXCLUDE_#{suffix.upcase}", '').split - Account.reorder(nil).where(username: excluded_usernames).pluck(:id) + Account.reorder(nil).where(username: excluded_usernames).pluck(:id).uniq end def excluded_from_env(suffix) - ENV.fetch("JANITOR_EXCLUDE_#{suffix.upcase}", '').split + ENV.fetch("JANITOR_EXCLUDE_#{suffix.upcase}", '').split.uniq end end -- cgit