fix: report each flock reissue, and scale the gap to the retry budget

Two non-blocking review observations.

A 45s retry is indistinguishable from a hang with nothing on the wire, so
GuestLockRetry.Execute takes an onRetry hook and InvokeGuestTask reports
each reissue through WriteVerbose.

The gap between attempts now scales with the budget, capped at the 2s
production value. A caller passing a short window wants a fast answer
rather than one long sleep, which also takes the retrying unit tests off
a real 2s sleep each: the xUnit run drops from 8s to 4s. PveHttpClient's
window becomes a field so those tests can shorten it too.
This commit is contained in:
goodolclint-claude[bot]
2026-09-01 21:49:00 -05:00
parent db416a3f03
commit 1e94d4188c
5 changed files with 64 additions and 14 deletions
@@ -25,6 +25,15 @@ namespace PSProxmoxVE.Core.Tests.Client
field.SetValue(client, newInner);
}
// The gap between attempts scales with the budget, so a short window keeps these
// tests off the 2s production sleep.
private static void SetRetryWindow(PveHttpClient client, TimeSpan window)
{
var field = typeof(PveHttpClient).GetField("_guestLockRetryWindow",
BindingFlags.Instance | BindingFlags.NonPublic)!;
field.SetValue(client, window);
}
private static (PveHttpClient client, ScriptedHandler handler) NewClient(
params (HttpStatusCode status, string body)[] responses)
{
@@ -33,6 +42,7 @@ namespace PSProxmoxVE.Core.Tests.Client
var client = new PveHttpClient(session);
var handler = new ScriptedHandler(responses);
SetInnerHttpClient(client, new HttpClient(handler));
SetRetryWindow(client, TimeSpan.FromMilliseconds(400));
return (client, handler);
}