MCPcopy Index your code
hub / github.com/coder/coder / isStaleSubscriptionStatus

Function isStaleSubscriptionStatus

coderd/webpush/webpush.go:37–46  ·  view source on GitHub ↗

isStaleSubscriptionStatus reports whether a status code from a push service indicates that the subscription is permanently invalid and should be removed from the database. Other 4xx and 5xx responses (rate limits, transient failures) leave the subscription in place so it can be retried on the next d

(statusCode int)

Source from the content-addressed store, hash-verified

35// (rate limits, transient failures) leave the subscription in place
36// so it can be retried on the next dispatch.
37func isStaleSubscriptionStatus(statusCode int) bool {
38 switch statusCode {
39 case http.StatusBadRequest, // 400: malformed subscription per the push service.
40 http.StatusForbidden, // 403: Apple BadJwtToken / VAPID rejected, key rotation.
41 http.StatusNotFound, // 404: FCM/Mozilla endpoint no longer valid.
42 http.StatusGone: // 410: standard "subscription expired" signal.
43 return true
44 }
45 return false
46}
47
48// Dispatcher is an interface that can be used to dispatch
49// web push notifications to clients such as browsers.

Callers 1

DispatchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected