Skip to content

PushDeliveryScheduler Class

Drains every push stream's queue on a timer.

C#
public sealed class PushDeliveryScheduler : Microsoft.Extensions.Hosting.BackgroundService

Inheritance System.ObjectMicrosoft.Extensions.Hosting.BackgroundService → PushDeliveryScheduler

Remarks

Push delivery is the transmitter reaching out, so something has to decide when. Without this a host that wired the transmitter and mapped its endpoints got streams created, events minted, signed and queued - and nothing delivered, with nothing logged and no error anywhere, because every part worked and none of them was called. Poll streams worked throughout, which made it read as "push is broken" rather than "push was never started".

A pass is best-effort by design. One stream's failure must not stop the others, so each is caught and logged and the sweep continues; the sender itself decides what a failed delivery means for the queue, keeping a transient refusal and dropping a final one.

Every instance of the application runs this, so each stream is claimed through an IDeliveryLease before it is swept. Without that, a pass reads a queue the other instances are reading at the same moment and every one of them POSTs the same SETs - which RFC 8935 Section 2 tells a transmitter not to do outside a suspected recoverable failure. The claim is what makes running N instances a division of the streams rather than N copies of the work.

Constructors

PushDeliveryScheduler(ILogger<PushDeliveryScheduler>, IStreamStore, PushDeliverySender, IDeliveryLease, SharedSignalsTransmitterOptions, TimeProvider) Constructor

Drains every push stream's queue on a timer.

C#
public PushDeliveryScheduler(Microsoft.Extensions.Logging.ILogger<Abblix.SharedSignals.Transmitter.PushDeliveryScheduler> logger, Abblix.SharedSignals.Transmitter.IStreamStore store, Abblix.SharedSignals.Transmitter.PushDeliverySender sender, Abblix.SharedSignals.Transmitter.IDeliveryLease lease, Abblix.SharedSignals.Transmitter.SharedSignalsTransmitterOptions options, System.TimeProvider timeProvider);

Parameters

logger Microsoft.Extensions.Logging.ILogger<PushDeliveryScheduler>

Records what a pass did, and what it could not do.

store IStreamStore

Where the streams to sweep are read from.

sender PushDeliverySender

Performs one stream's pass.

lease IDeliveryLease

Decides which instance sweeps a given stream this round.

options SharedSignalsTransmitterOptions

Carries the interval between passes and the claim's duration.

timeProvider System.TimeProvider

The clock the timer and the deadlines run on; a test hands in a fake.

Remarks

Push delivery is the transmitter reaching out, so something has to decide when. Without this a host that wired the transmitter and mapped its endpoints got streams created, events minted, signed and queued - and nothing delivered, with nothing logged and no error anywhere, because every part worked and none of them was called. Poll streams worked throughout, which made it read as "push is broken" rather than "push was never started".

A pass is best-effort by design. One stream's failure must not stop the others, so each is caught and logged and the sweep continues; the sender itself decides what a failed delivery means for the queue, keeping a transient refusal and dropping a final one.

Every instance of the application runs this, so each stream is claimed through an IDeliveryLease before it is swept. Without that, a pass reads a queue the other instances are reading at the same moment and every one of them POSTs the same SETs - which RFC 8935 Section 2 tells a transmitter not to do outside a suspected recoverable failure. The claim is what makes running N instances a division of the streams rather than N copies of the work.