You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
497 B

  1. class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
  2. disable_ddl_transaction!
  3. def up
  4. urls = Redis.current.smembers('unavailable_inboxes')
  5. hosts = urls.map do |url|
  6. Addressable::URI.parse(url).normalized_host
  7. end.compact.uniq
  8. UnavailableDomain.delete_all
  9. hosts.each do |host|
  10. UnavailableDomain.create(domain: host)
  11. end
  12. Redis.current.del(*(['unavailable_inboxes'] + Redis.current.keys('exhausted_deliveries:*')))
  13. end
  14. def down; end
  15. end