Class SidecarReaderSweeper
Debounced UnblockSidecarReadersAsync(CancellationToken) after Dapr subscriptions close, so a closed subscription's parked reader exits before it takes a message (see the positioner's remarks).
public sealed class SidecarReaderSweeper : IDisposable
- Inheritance
-
SidecarReaderSweeper
- Implements
- Inherited Members
Remarks
A sweep also wakes this pod's live readers. That's harmless (they read again, nothing is consumed) but costs each one a reconnect, so closes are batched: a burst of closes, e.g. a notebook's cleanup closing 20 topics, yields one sweep Virtufin.Api.Services.SidecarReaderSweeper.FirstDelay after the last close, plus one more Virtufin.Api.Services.SidecarReaderSweeper.SecondDelay later for subscriptions whose daprd-side drain (up to 5s) hadn't finished, i.e. whose context wasn't cancelled yet at the first sweep.
Constructors
SidecarReaderSweeper(IConsumerGroupPositioner, ILogger<SidecarReaderSweeper>)
Debounced UnblockSidecarReadersAsync(CancellationToken) after Dapr subscriptions close, so a closed subscription's parked reader exits before it takes a message (see the positioner's remarks).
public SidecarReaderSweeper(IConsumerGroupPositioner positioner, ILogger<SidecarReaderSweeper> logger)
Parameters
positionerIConsumerGroupPositionerloggerILogger<SidecarReaderSweeper>
Remarks
A sweep also wakes this pod's live readers. That's harmless (they read again, nothing is consumed) but costs each one a reconnect, so closes are batched: a burst of closes, e.g. a notebook's cleanup closing 20 topics, yields one sweep Virtufin.Api.Services.SidecarReaderSweeper.FirstDelay after the last close, plus one more Virtufin.Api.Services.SidecarReaderSweeper.SecondDelay later for subscriptions whose daprd-side drain (up to 5s) hadn't finished, i.e. whose context wasn't cancelled yet at the first sweep.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Request(string, IEnumerable<string>)
A subscription closed: (re)start the sweep timer. closedTopic
and openTopics (this pod's still-open topics, where a closed
reader of the same topic may have taken a live subscription's message) are
checked for abandoned pending entries; a burst's topics accumulate.
public void Request(string closedTopic, IEnumerable<string> openTopics)
Parameters
closedTopicstringopenTopicsIEnumerable<string>