Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return error if journal fails instead of waiting forever #176

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines/templates/stages/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stages:
scriptFolder: 'linux'

osx-x64:
vmImage: macos-11
vmImage: macos-latest
target: osx-x64
scriptFolder: 'macos'

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/templates/stages/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ stages:

- job: TestMacOS
pool:
vmImage: macos-11
vmImage: macos-latest

steps:
- template: ../restore.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public static WebApplication AddQueueEndpoints(this WebApplication app, IPOS pos
app.MapMultiplePrefixed(_prefixesV1, "Echo", EndpointRouteBuilderExtensions.MapPost, async (ifPOS.v1.EchoRequest req) => await pos.EchoAsync(req));
app.MapMultiplePrefixed(_prefixesV0, "Echo", EndpointRouteBuilderExtensions.MapPost, async ([FromBody] string message) => (await pos.EchoAsync(new ifPOS.v1.EchoRequest { Message = message })).Message);
app.MapMultiplePrefixed(_prefixes, "Sign", EndpointRouteBuilderExtensions.MapPost, async (ReceiptRequest req) => await pos.SignAsync(req));
app.MapMultiplePrefixed(_prefixes, "Journal", EndpointRouteBuilderExtensions.MapPost, ([FromQuery] long type, [FromQuery] long? from, [FromQuery] long? to) =>
app.MapMultiplePrefixed(_prefixes, "Journal", EndpointRouteBuilderExtensions.MapPost, async ([FromQuery] long type, [FromQuery] long? from, [FromQuery] long? to) =>
{
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
Loading