about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-05-14 03:22:48 +0200
committerGitHub <noreply@github.com>2017-05-14 03:22:48 +0200
commit657496b5a9488b904166c33764500b364e024679 (patch)
tree6776c7ca1f9878cf0d9e4b272a07b969bc89fe4d /app
parentfd03a3d95731d479f19bc4894746027097b9e2a3 (diff)
Do not cancel PuSH subscriptions after encountering "permanent" error… (#3046)
* Do not cancel PuSH subscriptions after encountering "permanent" error response

After talking with MMN about it, turns out some servers/php setups do
return 4xx errors while rebooting, so this anti-feature that was meant
to take load off of the hub is doing more harm than good in terms of
breaking subscriptions

* Update delivery_worker.rb
Diffstat (limited to 'app')
-rw-r--r--app/workers/pubsubhubbub/delivery_worker.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb
index 708a5fb9f..981838f33 100644
--- a/app/workers/pubsubhubbub/delivery_worker.rb
+++ b/app/workers/pubsubhubbub/delivery_worker.rb
@@ -23,13 +23,9 @@ class Pubsubhubbub::DeliveryWorker
   def process_delivery
     payload_delivery
 
-    if response_successful?
-      subscription.touch(:last_successful_delivery_at)
-    elsif response_failed_permanently?
-      subscription.destroy!
-    else
-      raise "Delivery failed for #{subscription.callback_url}: HTTP #{payload_delivery.code}"
-    end
+    raise "Delivery failed for #{subscription.callback_url}: HTTP #{payload_delivery.code}" unless response_successful?
+
+    subscription.touch(:last_successful_delivery_at)
   end
 
   def payload_delivery
@@ -82,10 +78,6 @@ class Pubsubhubbub::DeliveryWorker
     OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), subscription.secret, payload)
   end
 
-  def response_failed_permanently?
-    payload_delivery.code > 299 && payload_delivery.code < 500 && payload_delivery.code != 429
-  end
-
   def response_successful?
     payload_delivery.code > 199 && payload_delivery.code < 300
   end