Skip to content

Commit

Permalink
throw if journal fails instead of waiting forever
Browse files Browse the repository at this point in the history
  • Loading branch information
volllly committed Sep 19, 2024
1 parent b8ee2b0 commit e572c0e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public static WebApplication AddQueueEndpoints(this WebApplication app, IPOS pos
{
var pipe = new Pipe();
var journal = pos.JournalAsync(new JournalRequest { ftJournalType = type, From = from ?? 0, To = to ?? 0 });
// Throws if something failed in the request. Does not pop the first element
await journal.FirstAsync();
var _ = Task.Run(async () =>
{
await journal.ForEachAwaitAsync(async b => await pipe.Writer.WriteAsync(new ReadOnlyMemory<byte>(b.Chunk.ToArray())));
Expand Down

0 comments on commit e572c0e

Please sign in to comment.