about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-05 13:50:21 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-05 13:50:21 +0200
commit3319473b2c493ea422bd6b68b3d08adb8b5acfac (patch)
tree7fa010ab90249ca4a091f3726fa0efedd9e857e1 /app/workers
parent2febc6ed65330a00f311b373d508ede1cb8749e5 (diff)
Move PubSubHubbub pinging to a background worker
It can take as much as 0.5s if not longer to complete
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/hub_ping_worker.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/workers/hub_ping_worker.rb b/app/workers/hub_ping_worker.rb
new file mode 100644
index 000000000..57d716c97
--- /dev/null
+++ b/app/workers/hub_ping_worker.rb
@@ -0,0 +1,9 @@
+class HubPingWorker
+  include Sidekiq::Worker
+  include RoutingHelper
+
+  def perform(account_id)
+    account = Account.find(account_id)
+    account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
+  end
+end