[#28] Client: Use external GRPC Channnel
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
9bb7b5eff8
commit
c9418a1894
27 changed files with 520 additions and 438 deletions
|
@ -71,8 +71,6 @@ public class ClientWrapper : ClientStatusMonitor
|
|||
return;
|
||||
|
||||
await Task.Delay((int)WrapperPrm.GracefulCloseOnSwitchTimeout).ConfigureAwait(false);
|
||||
|
||||
Client.Close();
|
||||
}
|
||||
|
||||
// restartIfUnhealthy checks healthy status of client and recreate it if status is unhealthy.
|
||||
|
@ -98,31 +96,18 @@ public class ClientWrapper : ClientStatusMonitor
|
|||
await ScheduleGracefulClose().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
FrostFSClient? client = null;
|
||||
FrostFSClient? client = new(WrapperPrm, sessionCache);
|
||||
|
||||
try
|
||||
var error = await client.Dial(ctx).ConfigureAwait(false);
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
client = new(WrapperPrm, sessionCache);
|
||||
|
||||
var dialCtx = new CallContext(TimeSpan.FromTicks((long)WrapperPrm.DialTimeout), ctx.CancellationToken);
|
||||
|
||||
var error = await client.Dial(ctx).ConfigureAwait(false);
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
SetUnhealthyOnDial();
|
||||
return wasHealthy;
|
||||
}
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
Client = client;
|
||||
}
|
||||
|
||||
client = null;
|
||||
SetUnhealthyOnDial();
|
||||
return wasHealthy;
|
||||
}
|
||||
finally
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
client?.Dispose();
|
||||
Client = client;
|
||||
}
|
||||
|
||||
try
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue