sent_notifications += 1
except pywebpush.WebPushException as ex:
# Failed to send notification, delete this subscription
- app.logger.warning(f"Deleting dead push subscription: {subid} - {ex}")
- db.query("DELETE FROM users_push_subscriptions WHERE subid = ?", [subid])
- db.commit()
+ if (ex.response is not None) and (ex.response.status_code == 410):
+ app.logger.warning(f"Deleting dead push subscription: {subid} - {ex}")
+ db.query("DELETE FROM users_push_subscriptions WHERE subid = ?", [subid])
+ db.commit()
+ else:
+ app.logger.warning(f"Failed to send push subscription: {subid} - {ex}")
if sent_notifications > 0:
app.logger.info(f"Pushed {sent_notifications} notifications")