mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 16:26:30 +00:00
failsafe load dlls
add user config queue offsets throttle improvements
This commit is contained in:
@@ -71,9 +71,6 @@ public class InferenceClient : IInferenceClient
|
||||
_dealer.SendFrame(MessagePackSerializer.Serialize(command));
|
||||
}
|
||||
|
||||
public void SendString(string text) =>
|
||||
Send(new RemoteCommand(CommandType.Load, MessagePackSerializer.Serialize(text)));
|
||||
|
||||
public T? Get<T>(int retries = 24, int tryTimeoutSeconds = 5, CancellationToken ct = default) where T : class
|
||||
{
|
||||
var bytes = GetBytes(retries, tryTimeoutSeconds, ct);
|
||||
@@ -83,8 +80,9 @@ public class InferenceClient : IInferenceClient
|
||||
public byte[]? GetBytes(int retries = 24, int tryTimeoutSeconds = 5, CancellationToken ct = default)
|
||||
{
|
||||
var tryNum = 0;
|
||||
while (!ct.IsCancellationRequested && tryNum++ < retries)
|
||||
while (!ct.IsCancellationRequested && tryNum < retries)
|
||||
{
|
||||
tryNum++;
|
||||
if (!_dealer.TryReceiveFrameBytes(TimeSpan.FromSeconds(tryTimeoutSeconds), out var bytes))
|
||||
continue;
|
||||
|
||||
@@ -92,7 +90,7 @@ public class InferenceClient : IInferenceClient
|
||||
}
|
||||
|
||||
if (!ct.IsCancellationRequested)
|
||||
throw new Exception($"Unable to get bytes after {tryNum} retries, {tryTimeoutSeconds} seconds each");
|
||||
throw new Exception($"Unable to get bytes after {tryNum - 1} retries, {tryTimeoutSeconds} seconds each");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user