Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Timeout to Connection. #85

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/EdgeDB.Net.Driver/Clients/EdgeDBBinaryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public EdgeDBBinaryClient(
Connection = connection;
ServerKey = new byte[32];
MessageTimeout = TimeSpan.FromMilliseconds(clientConfig.MessageTimeout);
ConnectionTimeout = TimeSpan.FromMilliseconds(clientConfig.ConnectionTimeout);
ConnectionTimeout = TimeSpan.FromMilliseconds(connection.Timeout);
_stateDescriptorId = CodecBuilder.InvalidCodec;
ClientConfig = clientConfig;
_semaphore = new SemaphoreSlim(1, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/EdgeDB.Net.Driver/EdgeDBClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ internal async Task<BaseEdgeDBClient> GetOrCreateClientAsync(CancellationToken t
{
token.ThrowIfCancellationRequested();
return _availableClients.TryPop(out result);
}, (int)_poolConfig.ConnectionTimeout)
}, (int)_connection.Timeout)
? result!
: throw new TimeoutException($"Couldn't find a client after {_poolConfig.ConnectionTimeout}ms");
: throw new TimeoutException($"Couldn't find a client after {_connection.Timeout}ms");

client.AcceptHolder(await _poolHolder.GetPoolHandleAsync(token).ConfigureAwait(false));
return client.WithSession(_session);
Expand Down
6 changes: 0 additions & 6 deletions src/EdgeDB.Net.Driver/EdgeDBConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ public class EdgeDBConfig
/// </summary>
public uint MaxConnectionRetries { get; set; } = 5;

/// <summary>
/// Gets or sets the number of miliseconds a client will wait for a connection to be
/// established with the server.
/// </summary>
public uint ConnectionTimeout { get; set; } = 5000;

/// <summary>
/// Gets or sets the max amount of miliseconds a client will wait for an expected message.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions src/EdgeDB.Net.Driver/EdgeDBConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ public TLSSecurityMode TLSSecurity
set => _tlsSecurity = value;
}

/// <summary>
/// Gets or sets the number of miliseconds a client will wait for a connection to be
/// established with the server.
/// </summary>
[JsonProperty("wait_until_available")]
public uint Timeout { get; set; } = 30000;

/// <summary>
/// Gets or sets the secret key used to authenticate with cloud instances.
/// </summary>
Expand Down
Loading