mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-22 05:08:03 +00: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
|