mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-19 05:13:01 +00:00
Fix web push subscriptions being deleted on rate limit or timeout (#11826)
This commit is contained in:
parent
18331fefa2
commit
e8703c281e
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue