V10 / 66cebf3528e0
CalendarDelivery.cs
Lilith/Core/Calendar/CalendarDelivery.cs
Changed in this versionCS
namespace Lilith.Core.Calendar;
public static class CalendarDelivery
{
// Caller owns the host's conversation/narration gate, shared with scheduler delivery.
public static async Task DrainAsync(ProviderClient provider, Func<string, CancellationToken, Task> narrate, CancellationToken ct = default)
{
if (provider.Calendar is not { } calendar) return;
for (int i = 0; i < 10 && calendar.PeekNotice() is { } notice; i++)
{
ct.ThrowIfCancellationRequested();
provider.RecordCalendarNotice(notice);
await narrate(notice.Message, ct);
calendar.CompleteNotice(notice.Id);
}
}
}