(userID uuid.UUID, generation uint64, subscriptions []database.WebpushSubscription)
| 339 | } |
| 340 | |
| 341 | func (n *Webpusher) storeSubscriptions(userID uuid.UUID, generation uint64, subscriptions []database.WebpushSubscription) { |
| 342 | n.cacheMu.Lock() |
| 343 | defer n.cacheMu.Unlock() |
| 344 | |
| 345 | if n.subscriptionGenerations[userID] != generation { |
| 346 | return |
| 347 | } |
| 348 | |
| 349 | n.subscriptionCache[userID] = cachedSubscriptions{ |
| 350 | subscriptions: slices.Clone(subscriptions), |
| 351 | expiresAt: n.clock.Now().Add(n.subscriptionCacheTTL), |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | func (n *Webpusher) pruneSubscriptions(userID uuid.UUID, staleIDs []uuid.UUID) { |
| 356 | if len(staleIDs) == 0 { |
no test coverage detected