Skip to content
Snippets Groups Projects
Unverified Commit e8703c28 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix web push subscriptions being deleted on rate limit or timeout (#11826)

parent 18331fef
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,13 @@ class Web::PushNotificationWorker ...@@ -11,7 +11,13 @@ class Web::PushNotificationWorker
subscription.push(notification) unless notification.activity.nil? subscription.push(notification) unless notification.activity.nil?
rescue Webpush::ResponseError => e rescue Webpush::ResponseError => e
subscription.destroy! if (400..499).cover?(e.response.code.to_i) code = e.response.code.to_i
if (400..499).cover?(code) && ![408, 429].include?(code)
subscription.destroy!
else
raise e
end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
true true
end end
......
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