Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Mar 5, 2024
1 parent 65163a6 commit ccb265d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Ydb.Sdk/src/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ public async Task Initialize()
}

_logger.LogInformation("Started initial endpoint discovery");

var successDiscover = false;


for (var i = 0; i < _config.AttemptDiscovery; i++)
{
try
{
var status = await DiscoverEndpoints();
if (status.IsSuccess)
{
successDiscover = true;
break;
_ = Task.Run(PeriodicDiscovery);

return;
}

_logger.LogCritical($"Error during initial endpoint discovery: {status}");
Expand All @@ -103,13 +102,8 @@ public async Task Initialize()
_logger.LogCritical($"RPC error during initial endpoint discovery: {e.Status}");
}
}

if (!successDiscover)
{
throw new InitializationFailureException("Error during initial endpoint discovery");
}

_ = Task.Run(PeriodicDiscovery);

throw new InitializationFailureException("Error during initial endpoint discovery");
}

internal async Task<UnaryResponse<TResponse>> UnaryCall<TRequest, TResponse>(
Expand Down

0 comments on commit ccb265d

Please sign in to comment.