diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-26 13:42:10 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-26 13:42:10 +0100 |
commit | 85b00d19b840bae98322c2372e8e0e3ebd66f2e0 (patch) | |
tree | 7eee05cd92cdcc0b97a07d2a94f8ee661f6eaca7 /app/services | |
parent | da4b675aca2c68e976d7920d3fc5b7e2881d1d86 (diff) |
Moving Salmon notifications to background processing, fixing mini-profiler
behaviour with Turbolinks enabled, optimizing Rabl for production
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/favourite_service.rb | 8 | ||||
-rw-r--r-- | app/services/follow_service.rb | 6 | ||||
-rw-r--r-- | app/services/process_mentions_service.rb | 6 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 8 | ||||
-rw-r--r-- | app/services/unfollow_service.rb | 8 |
5 files changed, 6 insertions, 30 deletions
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb index 4a8ecfacb..3d0bc718c 100644 --- a/app/services/favourite_service.rb +++ b/app/services/favourite_service.rb @@ -10,15 +10,9 @@ class FavouriteService < BaseService if status.local? NotificationMailer.favourite(status, account).deliver_later else - send_interaction_service.(favourite.stream_entry, status.account) + NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id) end favourite end - - private - - def send_interaction_service - @send_interaction_service ||= SendInteractionService.new - end end diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 0661c63f7..06bbfa8f0 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -8,7 +8,7 @@ class FollowService < BaseService return nil if target_account.nil? follow = source_account.follow!(target_account) - send_interaction_service.(follow.stream_entry, target_account) + NotificationWorker.perform_async(follow.stream_entry.id, target_account.id) source_account.ping!(account_url(source_account, format: 'atom'), [Rails.configuration.x.hub_url]) follow end @@ -18,8 +18,4 @@ class FollowService < BaseService def follow_remote_account_service @follow_remote_account_service ||= FollowRemoteAccountService.new end - - def send_interaction_service - @send_interaction_service ||= SendInteractionService.new - end end diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index ba9486c1f..aec150a94 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -24,7 +24,7 @@ class ProcessMentionsService < BaseService if mentioned_account.local? NotificationMailer.mention(mentioned_account, status).deliver_later else - send_interaction_service.(status.stream_entry, mentioned_account) + NotificationWorker.perform_async(status.stream_entry.id, mentioned_account.id) end end end @@ -34,8 +34,4 @@ class ProcessMentionsService < BaseService def follow_remote_account_service @follow_remote_account_service ||= FollowRemoteAccountService.new end - - def send_interaction_service - @send_interaction_service ||= SendInteractionService.new - end end diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index 606970e23..f149477c7 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -5,13 +5,13 @@ class ReblogService < BaseService # @return [Status] def call(account, reblogged_status) reblog = account.statuses.create!(reblog: reblogged_status, text: '') - fan_out_on_write_service.(reblog) + DistributionWorker.perform_async(reblog.id) account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url]) if reblogged_status.local? NotificationMailer.reblog(reblogged_status, account).deliver_later else - send_interaction_service.(reblog.stream_entry, reblogged_status.account) + NotificationWorker.perform_async(reblog.stream_entry.id, reblogged_status.account_id) end reblog @@ -22,8 +22,4 @@ class ReblogService < BaseService def send_interaction_service @send_interaction_service ||= SendInteractionService.new end - - def fan_out_on_write_service - @fan_out_on_write_service ||= FanOutOnWriteService.new - end end diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb index 039838d32..92d86a2c5 100644 --- a/app/services/unfollow_service.rb +++ b/app/services/unfollow_service.rb @@ -4,12 +4,6 @@ class UnfollowService < BaseService # @param [Account] target_account Which to unfollow def call(source_account, target_account) follow = source_account.unfollow!(target_account) - send_interaction_service.(follow.stream_entry, target_account) unless target_account.local? - end - - private - - def send_interaction_service - @send_interaction_service ||= SendInteractionService.new + NotificationWorker.perform_async(follow.stream_entry.id, target_account.id) unless target_account.local? end end |