diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-05-02 22:10:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 22:10:57 +0200 |
commit | 658cbc94255a91453fbadd175cd45ad15efcbdf3 (patch) | |
tree | f70a7ef825bec3ff1bc3c066891e7f6df6c61370 /app/workers | |
parent | cb5b5cb5f79bb2187d8124df91af4c8e1bfd7256 (diff) |
Improve PostStatusService performance (#7317)
Offload creation of local notifications to a worker. Remove two redundant SQL queries from ProcessMentionsService, remove n+1 XML/JSON serialization via memoization
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/local_notification_worker.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/workers/local_notification_worker.rb b/app/workers/local_notification_worker.rb new file mode 100644 index 000000000..748270563 --- /dev/null +++ b/app/workers/local_notification_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class LocalNotificationWorker + include Sidekiq::Worker + + def perform(mention_id) + mention = Mention.find(mention_id) + NotifyService.new.call(mention.account, mention) + rescue ActiveRecord::RecordNotFound + true + end +end |