diff options
author | Eugen <eugen@zeonfederated.com> | 2017-04-05 03:19:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 03:19:14 +0200 |
commit | 78c1e2e9582f582b627e0144076bb76a886a41c2 (patch) | |
tree | 259de6b676b6ca29687faa770089e3957049ea65 /app/workers | |
parent | 7015578655553b89e0184e6fe10b88075f4d8446 (diff) | |
parent | ab98591af83ef7a617a877cc8519b203e0481e8a (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) |