pwa: delete pwa push subscription on 410 errors (#41304)

This commit is contained in:
Frédéric Péters 2020-05-19 10:12:09 +02:00
parent 8f4a5869bd
commit f51551101c
1 changed files with 3 additions and 0 deletions

View File

@ -59,5 +59,8 @@ def notification(sender, instance=None, created=False, **kwargs):
vapid_claims=claims,
)
except pywebpush.WebPushException as e:
if str(e) == 'Push failed: 410 Gone':
subscription.delete()
continue
logger = logging.getLogger(__name__)
logger.exception('webpush error (%r)', e)