diff options
author | Eugen <eugen@zeonfederated.com> | 2017-04-05 03:18:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 03:18:42 +0200 |
commit | bdaf31bcc91d309d667b173bfa660f74d5569474 (patch) | |
tree | c36c6c1f2bbc52e5e1d3067db2fbdb202bc1626b /app/workers | |
parent | 58bdb9b42ee90ca2723ac28c0f45af40df1c6383 (diff) | |
parent | 086a88f3bb3e09ade9d5659d60e5b0445b30dbed (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/feed_insert_worker.rb | 15 | ||||
-rw-r--r-- | app/workers/pubsubhubbub/delivery_worker.rb | 1 |
2 files changed, 16 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 diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb index 15005bc80..466def3a8 100644 --- a/app/workers/pubsubhubbub/delivery_worker.rb +++ b/app/workers/pubsubhubbub/delivery_worker.rb @@ -22,6 +22,7 @@ class Pubsubhubbub::DeliveryWorker .headers(headers) .post(subscription.callback_url, body: payload) + return subscription.destroy! if response.code > 299 && response.code < 500 && response.code != 429 # HTTP 4xx means error is not temporary, except for 429 (throttling) raise "Delivery failed for #{subscription.callback_url}: HTTP #{response.code}" unless response.code > 199 && response.code < 300 subscription.touch(:last_successful_delivery_at) |