Last active
September 25, 2021 07:43
-
-
Save tribela/374ecfbd3cf4e99915dfe7c077466210 to your computer and use it in GitHub Desktop.
Resend Delete activity about suspended accounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run "bundle exec sidekiq -q tmp -c 32" to run in side of main sidekiq jobs to prevent huge latency on push queue | |
dry_run = 1 # Change this to nil to run actually | |
inboxes = Account.inboxes | |
worker = ActivityPub::DeliveryWorker.new | |
worker.sidekiq_options_hash['retry'] = 0 | |
worker.sidekiq_options_hash['queue'] = 'tmp' | |
processed = 0 | |
Account.local.suspended.find_each do |account| | |
payload = ActiveModelSerializers::SerializableResource.new( | |
account, | |
serializer: ActivityPub::DeleteActorSerializer, | |
adapter: ActivityPub::Adapter | |
).as_json | |
json = Oj.dump(ActivityPub::LinkedDataSignature.new(payload).sign!(account)) | |
unless dry_run | |
worker.push_bulk(inboxes) do |inbox_url| | |
[json, account.id, inbox_url] | |
end | |
end | |
processed += 1 | |
end | |
p("Queued #{inboxes.size * processed} items into sidekiq for #{processed} accounts") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As misskey was ignoring remote users' Delete activity, It is not bad for resending Delete activity for deleted accounts.