mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 20:15:10 +01:00
922837dc96
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
23 lines
518 B
Ruby
23 lines
518 B
Ruby
class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
|
|
disable_ddl_transaction!
|
|
|
|
def up
|
|
redis = RedisConfiguration.pool.checkout
|
|
urls = redis.smembers('unavailable_inboxes')
|
|
|
|
hosts = urls.map do |url|
|
|
Addressable::URI.parse(url).normalized_host
|
|
end.compact.uniq
|
|
|
|
UnavailableDomain.delete_all
|
|
|
|
hosts.each do |host|
|
|
UnavailableDomain.create(domain: host)
|
|
end
|
|
|
|
redis.del(*(['unavailable_inboxes'] + redis.keys('exhausted_deliveries:*')))
|
|
end
|
|
|
|
def down; end
|
|
end
|