2020-05-28 13:28:07 +00:00
|
|
|
class ImapAuthenticationMigrationCleanupJob < ApplicationJob
|
|
|
|
include HasActiveJobLock
|
|
|
|
|
|
|
|
def perform
|
2020-10-27 14:05:10 +00:00
|
|
|
Channel.where(area: ['Google::Account', 'Microsoft365::Account']).find_each do |channel|
|
2020-05-28 13:28:07 +00:00
|
|
|
next if channel.options.blank?
|
|
|
|
next if channel.options[:backup_imap_classic].blank?
|
|
|
|
next if channel.options[:backup_imap_classic][:migrated_at] > 7.days.ago
|
|
|
|
|
|
|
|
channel.options.delete(:backup_imap_classic)
|
|
|
|
channel.save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|