diff options
-rw-r--r-- | app/workers/scheduler/defang_scheduler.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/workers/scheduler/defang_scheduler.rb b/app/workers/scheduler/defang_scheduler.rb index ea999572d..7476cc933 100644 --- a/app/workers/scheduler/defang_scheduler.rb +++ b/app/workers/scheduler/defang_scheduler.rb @@ -5,9 +5,10 @@ class Scheduler::DefangScheduler include ServiceAccountHelper def perform - User.where(defanged: false, last_fanged_at: nil).or(User.where('last_fanged_at <= ?', 15.minutes.ago)) do |user| + User.where(defanged: false, last_fanged_at: nil).or(User.where('last_fanged_at <= ?', 15.minutes.ago)).find_each do |user| user.defang! next unless user&.account.present? + service_dm('announcements', user.account, "You are no longer in #{user.role} mode.", footer: 'auto-defang') end end |