diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-12-17 03:14:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 03:14:13 +0100 |
commit | 628da11e38b0580a074268f32d09791ed6278def (patch) | |
tree | 757ecff88ba7fed80bdd1f2acf6a1a40c460dfff /app/workers/web | |
parent | 4297de34cfe705622d53d9688c1ad9abb24ced76 (diff) |
Do no retry web push workers if the server returns a 4xx response (#9434)
Add timeout of 10s to web push requests
Diffstat (limited to 'app/workers/web')
-rw-r--r-- | app/workers/web/push_notification_worker.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb index 4a40e5c8b..8e8a35973 100644 --- a/app/workers/web/push_notification_worker.rb +++ b/app/workers/web/push_notification_worker.rb @@ -10,8 +10,8 @@ class Web::PushNotificationWorker notification = Notification.find(notification_id) subscription.push(notification) unless notification.activity.nil? - rescue Webpush::InvalidSubscription, Webpush::ExpiredSubscription - subscription.destroy! + rescue Webpush::ResponseError => e + subscription.destroy! if (400..499).cover?(e.response.code.to_i) rescue ActiveRecord::RecordNotFound true end |