imap_authentication_migration_cleanup_job.rb 434 B

1234567891011121314
  1. class ImapAuthenticationMigrationCleanupJob < ApplicationJob
  2. include HasActiveJobLock
  3. def perform
  4. Channel.where(area: 'Google::Account').find_each do |channel|
  5. next if channel.options.blank?
  6. next if channel.options[:backup_imap_classic].blank?
  7. next if channel.options[:backup_imap_classic][:migrated_at] > 7.days.ago
  8. channel.options.delete(:backup_imap_classic)
  9. channel.save!
  10. end
  11. end
  12. end