Fix sidekiq JSON serialization warning in ActivityPub::FetchAllRepliesWorker (#34702)

This commit is contained in:
Claire 2025-05-16 11:07:33 +02:00 committed by GitHub
parent c058c45a8e
commit 3ea1f074ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View file

@ -80,7 +80,7 @@ class ActivityPub::FetchAllRepliesWorker
root_status_body = fetch_resource(root_status_uri, true) root_status_body = fetch_resource(root_status_uri, true)
return if root_status_body.nil? return if root_status_body.nil?
FetchReplyWorker.perform_async(root_status_uri, { **options, prefetched_body: root_status_body }) FetchReplyWorker.perform_async(root_status_uri, { **options.deep_stringify_keys, 'prefetched_body' => root_status_body })
get_replies(root_status_body, MAX_PAGES, options) get_replies(root_status_body, MAX_PAGES, options)
end end

View file

@ -124,8 +124,6 @@ RSpec.describe ActivityPub::FetchAllRepliesWorker do
before do before do
stub_const('Status::FetchRepliesConcern::FETCH_REPLIES_ENABLED', true) stub_const('Status::FetchRepliesConcern::FETCH_REPLIES_ENABLED', true)
allow(FetchReplyWorker).to receive(:push_bulk)
allow(FetchReplyWorker).to receive(:perform_async)
all_items.each do |item| all_items.each do |item|
next if [top_note_uri, reply_note_uri].include? item next if [top_note_uri, reply_note_uri].include? item
@ -150,7 +148,7 @@ RSpec.describe ActivityPub::FetchAllRepliesWorker do
it 'fetches the top status only once' do it 'fetches the top status only once' do
_ = subject.perform(status.id, { request_id: 0 }) _ = subject.perform(status.id, { request_id: 0 })
expect(FetchReplyWorker).to have_received(:perform_async).with(top_note_uri, { prefetched_body: top_object.deep_stringify_keys, request_id: 0 }) expect(FetchReplyWorker).to have_enqueued_sidekiq_job(top_note_uri, { 'prefetched_body' => top_object.deep_stringify_keys, 'request_id' => 0 })
expect(a_request(:get, top_note_uri)).to have_been_made.once expect(a_request(:get, top_note_uri)).to have_been_made.once
end end
end end