InvalidateUser clears the cached subscriptions for a user and advances its invalidation generation. Local subscribe and unsubscribe handlers call this after mutating subscriptions in the same process.
(userID uuid.UUID)
| 394 | // its invalidation generation. Local subscribe and unsubscribe handlers call |
| 395 | // this after mutating subscriptions in the same process. |
| 396 | func (n *Webpusher) InvalidateUser(userID uuid.UUID) { |
| 397 | n.cacheMu.Lock() |
| 398 | delete(n.subscriptionCache, userID) |
| 399 | n.subscriptionGenerations[userID]++ |
| 400 | n.cacheMu.Unlock() |
| 401 | n.subscriptionFetches.Forget(userID.String()) |
| 402 | } |
| 403 | |
| 404 | func (n *Webpusher) webpushSend(ctx context.Context, msg []byte, endpoint string, keys webpush.Keys) (int, []byte, error) { |
| 405 | // Copy the message to avoid modifying the original. |