Class: Jobs::AdminProblems
- Defined in:
- app/jobs/scheduled/admin_problems.rb
Instance Method Summary collapse
Methods inherited from Scheduled
Methods inherited from Base
acquire_cluster_concurrency_lock!, clear_cluster_concurrency_lock!, cluster_concurrency, cluster_concurrency_redis_key, delayed_perform, #error_context, get_cluster_concurrency, #last_db_duration, #log, #perform, #perform_immediately
Instance Method Details
#execute(args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/jobs/scheduled/admin_problems.rb', line 7 def execute(args) Notification .where(notification_type: Notification.types[:admin_problems]) .where("created_at < ?", 7.days.ago) .destroy_all return if !persistent_problems? notified_user_ids = Notification.where(notification_type: Notification.types[:admin_problems]).pluck(:user_id) users = Group[:admins].users.where.not(id: notified_user_ids) users.each do |user| Notification.create!( notification_type: Notification.types[:admin_problems], user_id: user.id, data: "{}", ) end end |