about summary refs log tree commit diff
path: root/app/services/fan_out_on_write_service.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-01-28 00:43:56 +0100
committerGitHub <noreply@github.com>2022-01-28 00:43:56 +0100
commit03d59340da3ffc380d7b27169bdc887140d88bee (patch)
tree32f4a9835d860de7b3b2d0a42b42202c57f6d2e7 /app/services/fan_out_on_write_service.rb
parent14c69a535bcf5c96459a802093463e0bd1a8ef66 (diff)
Fix Sidekiq warnings about JSON serialization (#17381)
* Fix Sidekiq warnings about JSON serialization

This occurs on every symbol argument we pass, and every symbol key in hashes,
because Sidekiq expects strings instead.

See https://github.com/mperham/sidekiq/pull/5071

We do not need to change how workers parse their arguments because this has
not changed and we were already converting to symbols adequately or using
`with_indifferent_access`.

* Set Sidekiq to raise on unsafe arguments in test mode

In order to more easily catch issues that would produce warnings in production
code.
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r--app/services/fan_out_on_write_service.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 3a2e82b6d..4f847e293 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -59,7 +59,7 @@ class FanOutOnWriteService < BaseService
   def notify_mentioned_accounts!
     @status.active_mentions.where.not(id: @options[:silenced_account_ids] || []).joins(:account).merge(Account.local).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
       LocalNotificationWorker.push_bulk(mentions) do |mention|
-        [mention.account_id, mention.id, 'Mention', :mention]
+        [mention.account_id, mention.id, 'Mention', 'mention']
       end
     end
   end
@@ -67,7 +67,7 @@ class FanOutOnWriteService < BaseService
   def deliver_to_all_followers!
     @account.followers_for_local_distribution.select(:id).reorder(nil).find_in_batches do |followers|
       FeedInsertWorker.push_bulk(followers) do |follower|
-        [@status.id, follower.id, :home, update: update?]
+        [@status.id, follower.id, 'home', { 'update' => update? }]
       end
     end
   end
@@ -75,7 +75,7 @@ class FanOutOnWriteService < BaseService
   def deliver_to_lists!
     @account.lists_for_local_distribution.select(:id).reorder(nil).find_in_batches do |lists|
       FeedInsertWorker.push_bulk(lists) do |list|
-        [@status.id, list.id, :list, update: update?]
+        [@status.id, list.id, 'list', { 'update' => update? }]
       end
     end
   end
@@ -83,7 +83,7 @@ class FanOutOnWriteService < BaseService
   def deliver_to_mentioned_followers!
     @status.mentions.joins(:account).merge(@account.followers_for_local_distribution).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
       FeedInsertWorker.push_bulk(mentions) do |mention|
-        [@status.id, mention.account_id, :home, update: update?]
+        [@status.id, mention.account_id, 'home', { 'update' => update? }]
       end
     end
   end