Skip to content
Merged
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions dotnet/EcencyApi/Handlers/SsrRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,21 @@ internal static async Task<Resolution> Resolve(MethodPolicy policy, JsonNode @pa
var bytes = await pending.Task;
return new Resolution(coalesced ? Outcome.Coalesced : Outcome.Miss, bytes, null);
}
catch (FillRejectedException) when (coalesced && !retried)
catch (FillRejectedException) when (coalesced && !retried && Environment.TickCount64 < deadline)
{
// The fill this reader attached to was judged expired (or refused) before
// the reader's own wait began, which can only happen if the reader was
// descheduled for longer than the budget between attaching and waiting.
// Its budget has not been spent on anything yet, so start over once.
// While its deadline has not passed, start over once; past it, the
// lookup is a timeout and no replacement fill is started for it.
retried = true;
goto again;
}
catch (FillRejectedException) when (coalesced)
{
Interlocked.Increment(ref counter.Timeout);
return new Resolution(Outcome.Timeout, Array.Empty<byte>(), "budget exceeded");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep pre-deadline repeat rejections unavailable

When a reader retries after coalescing onto one rejected fill and then coalesces onto another fill that is rejected immediately because the queue is full, retried is already true, so this catch returns Timeout/HTTP 504 even though the lookup deadline has not elapsed. This is possible during the queue-saturation scenario that produces FillRejectedException("fill queue full"); the second catch should be restricted to an expired deadline so a repeat rejection before the deadline retains the existing Unavailable/502 result and error accounting.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8a6cb09: only a rejection past the lookup's deadline is reported as a timeout; a repeat rejection before it (the queue full twice) falls through to the unavailable result with its error accounting, as before.

Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
Outdated
}
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Outdated
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
catch (HiveRpcClient.RpcException e)
{
Interlocked.Increment(ref counter.Error);
Expand Down
Loading