about summary refs log tree commit diff
path: root/app/workers/web/push_notification_worker.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-09-18 17:25:56 +0200
committerThibaut Girka <thib@sitedethib.com>2019-09-18 17:25:56 +0200
commit5cadb4723832b91068ee51955b9d4b1336502369 (patch)
tree2e915e53ee0d25ea63ee3910ae8ced44f3295e21 /app/workers/web/push_notification_worker.rb
parentab646fac5f582fe9bef22d8b9a4995fbb4b42d7d (diff)
parentd0c2c5278391b82ba7fa2f230bf237805ff61a0c (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/controllers/auth/sessions_controller.rb
  Minor conflict due to glitch-soc's theming code
Diffstat (limited to 'app/workers/web/push_notification_worker.rb')
-rw-r--r--app/workers/web/push_notification_worker.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb
index 901043975..46aeaa30b 100644
--- a/app/workers/web/push_notification_worker.rb
+++ b/app/workers/web/push_notification_worker.rb
@@ -11,7 +11,13 @@ class Web::PushNotificationWorker
 
     subscription.push(notification) unless notification.activity.nil?
   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
     true
   end