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.

22 lines
518 B

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