about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-04-04 19:21:37 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-04 19:21:37 +0200
commit6fd865c0004efbf11ee87c06fea9f48af567fabe (patch)
treecbb9e0c86c65ea27e5d11c317f71e826c790af65 /app/workers
parent5f54981846508daf9558f66ffd70d42d8213bea9 (diff)
Spawn FeedInsertWorker to deliver status into personal feed
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/feed_insert_worker.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/workers/feed_insert_worker.rb b/app/workers/feed_insert_worker.rb
new file mode 100644
index 000000000..a58dfaa74
--- /dev/null
+++ b/app/workers/feed_insert_worker.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class FeedInsertWorker
+  include Sidekiq::Worker
+
+  def perform(status_id, follower_id)
+    status   = Status.find(status_id)
+    follower = Account.find(follower_id)
+
+    return if FeedManager.instance.filter?(:home, status, follower.id)
+    FeedManager.instance.push(:home, follower, status)
+  rescue ActiveRecord::RecordNotFound
+    true
+  end
+end