fix: bound long-lived cache state

This commit is contained in:
jxxghp
2026-05-24 18:03:42 +08:00
parent dc73d61682
commit 79539760da
15 changed files with 380 additions and 24 deletions
+12
View File
@@ -0,0 +1,12 @@
from typing import Any
from pywebpush import WebPushException
def is_webpush_subscription_gone(error: WebPushException) -> bool:
"""
判断 WebPush 订阅是否已经在浏览器或推送服务侧失效。
"""
response: Any = getattr(error, "response", None)
status_code = getattr(response, "status_code", None) or getattr(response, "status", None)
return status_code in {404, 410}