Skip to content

Instantly share code, notes, and snippets.

@tribela
Last active September 25, 2021 07:43
Show Gist options
  • Save tribela/374ecfbd3cf4e99915dfe7c077466210 to your computer and use it in GitHub Desktop.
Save tribela/374ecfbd3cf4e99915dfe7c077466210 to your computer and use it in GitHub Desktop.
Resend Delete activity about suspended accounts
# 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")
@tribela
Copy link
Author

tribela commented Sep 25, 2021

As misskey was ignoring remote users' Delete activity, It is not bad for resending Delete activity for deleted accounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment