Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@tribela 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