Skip to content
Snippets Groups Projects
Commit bda37489 authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Remove PuSH subscriptions when delivery is answered with a 4xx error

parent ed22f65b
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment