about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-23 21:29:34 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-23 21:29:34 +0100
commitcca82bf0a2f0ccbf0feda00763fd7df0877845b6 (patch)
tree98afb883aa236dbeaf011944faa1548e7698deb7 /app/workers
parentf392030ab82a70086f93bb02c3faab53c3fbd28e (diff)
Move merging/unmerging of timelines into background. Move blocking into
background as well since it's a computationally expensive
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/block_worker.rb9
-rw-r--r--app/workers/merge_worker.rb9
-rw-r--r--app/workers/unmerge_worker.rb9
3 files changed, 27 insertions, 0 deletions
diff --git a/app/workers/block_worker.rb b/app/workers/block_worker.rb
new file mode 100644
index 000000000..dc00db197
--- /dev/null
+++ b/app/workers/block_worker.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class BlockWorker
+  include Sidekiq::Worker
+
+  def perform(account_id, target_account_id)
+    BlockService.new.call(Account.find(account_id), Account.find(target_account_id))
+  end
+end
diff --git a/app/workers/merge_worker.rb b/app/workers/merge_worker.rb
new file mode 100644
index 000000000..0f288f43f
--- /dev/null
+++ b/app/workers/merge_worker.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class MergeWorker
+  include Sidekiq::Worker
+
+  def perform(from_account_id, into_account_id)
+    FeedManager.instance.merge_into_timeline(Account.find(from_account_id), Account.find(into_account_id))
+  end
+end
diff --git a/app/workers/unmerge_worker.rb b/app/workers/unmerge_worker.rb
new file mode 100644
index 000000000..dbf7243de
--- /dev/null
+++ b/app/workers/unmerge_worker.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class UnmergeWorker
+  include Sidekiq::Worker
+
+  def perform(from_account_id, into_account_id)
+    FeedManager.instance.unmerge_from_timeline(Account.find(from_account_id), Account.find(into_account_id))
+  end
+end