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

Method storeSubscriptions

coderd/webpush/webpush.go:341–353  ·  view source on GitHub ↗
(userID uuid.UUID, generation uint64, subscriptions []database.WebpushSubscription)

Source from the content-addressed store, hash-verified

339}
340
341func (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
355func (n *Webpusher) pruneSubscriptions(userID uuid.UUID, staleIDs []uuid.UUID) {
356 if len(staleIDs) == 0 {

Callers 1

subscriptionsForUserMethod · 0.95

Calls 4

AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
CloneMethod · 0.45

Tested by

no test coverage detected