Class WebhookSubscriptionCache
The enabled webhook subscriptions, kept in memory for Delivery.SubscriptionCache. Every event
asks which subscriptions it goes to; without the cache that is one database read per event, token
issuance included. The webhook management processor drops the cached list on every change, so this
node sees a change at once and other nodes within the cache time.
Events that find no list while a read is already running wait for that read instead of starting their
own, so a burst of events costs one read. A read that fails answers the events waiting for it with its
error and is not kept; the next event reads again.
A read that was already running when the list was dropped may have missed the change: its result
answers the events that waited for it but is not kept, and events after the drop do not join it, so
the next event reads the list again.
public sealed class WebhookSubscriptionCache
Inheritance
Properties
Loads
Number of reads of the list from the database, counted when a read starts, failed reads included;
public int Loads { get; }
Methods
GetEnabledAsync(IRedbService, CancellationToken)
The enabled subscriptions, read through redb's database. The read is shared by every
public Task<IReadOnlyList<RedbObject<WebhookSubscriptionProps>>> GetEnabledAsync(IRedbService redb, CancellationToken ct = default)
Invalidate()
Drops the cached list; the next event reads it again, without joining a read already running.
public void Invalidate()