Skip to content

Commit 8be0773

Browse files
committed
Rename FewestConnections to LeastConnections.
"Least Connections" is the more widely used term.
1 parent 73e3110 commit 8be0773

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/content/connection-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ These are the other options that MySqlConnector supports. They are set to sensib
203203
<dd>Each new connection tries the hosts in order, starting with the first one. This is the default if <code>Pooling=False</code>.</dd>
204204
<dt>Random</dt>
205205
<dd>Servers are tried in a random order.</dd>
206-
<dt>FewestConnections</dt>
206+
<dt>LeastConnections</dt>
207207
<dd>Servers are tried in ascending order of number of currently-open connections in this connection pool. Requires <code>Pooling=True</code>.
208208
</dl>
209209
</tr>

src/MySqlConnector/Core/ConnectionPool.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public async Task ReapAsync(IOBehavior ioBehavior, CancellationToken cancellatio
150150

151151
/// <summary>
152152
/// Examines all the <see cref="ServerSession"/> objects in <see cref="m_leasedSessions"/> to determine if any
153-
/// have an owning <see cref="MySqlConnection"/> that has been garbage-collected. If so, assumes that the connection
153+
/// have an owning <see cref="MySqlConnection"/> that has been garbage-collected. If so, assumes that the connection
154154
/// was not properly disposed and returns the session to the pool.
155155
/// </summary>
156156
private void RecoverLeakedSessions()
@@ -344,7 +344,7 @@ private ConnectionPool(ConnectionSettings cs)
344344
m_sessionSemaphore = new SemaphoreSlim(cs.MaximumPoolSize);
345345
m_sessions = new LinkedList<ServerSession>();
346346
m_leasedSessions = new Dictionary<int, ServerSession>();
347-
if (cs.LoadBalance == MySqlLoadBalance.FewestConnections)
347+
if (cs.LoadBalance == MySqlLoadBalance.LeastConnections)
348348
{
349349
m_hostSessions = new Dictionary<string, int>();
350350
foreach (var hostName in cs.HostNames)
@@ -353,7 +353,7 @@ private ConnectionPool(ConnectionSettings cs)
353353
m_loadBalancer = cs.ConnectionType != ConnectionType.Tcp ? null :
354354
cs.HostNames.Count == 1 || cs.LoadBalance == MySqlLoadBalance.InOrder ? InOrderLoadBalancer.Instance :
355355
cs.LoadBalance == MySqlLoadBalance.Random ? RandomLoadBalancer.Instance :
356-
cs.LoadBalance == MySqlLoadBalance.FewestConnections ? new FewestConnectionsLoadBalancer(this) :
356+
cs.LoadBalance == MySqlLoadBalance.LeastConnections ? new LeastConnectionsLoadBalancer(this) :
357357
(ILoadBalancer) new RoundRobinLoadBalancer();
358358
}
359359

@@ -366,9 +366,9 @@ private void AdjustHostConnectionCount(ServerSession session, int delta)
366366
}
367367
}
368368

369-
private sealed class FewestConnectionsLoadBalancer : ILoadBalancer
369+
private sealed class LeastConnectionsLoadBalancer : ILoadBalancer
370370
{
371-
public FewestConnectionsLoadBalancer(ConnectionPool pool) => m_pool = pool;
371+
public LeastConnectionsLoadBalancer(ConnectionPool pool) => m_pool = pool;
372372

373373
public IEnumerable<string> LoadBalance(IReadOnlyList<string> hosts)
374374
{

src/MySqlConnector/MySql.Data.MySqlClient/MySqlLoadBalance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public enum MySqlLoadBalance
2020
/// <summary>
2121
/// Servers are tried in ascending order of number of currently-open connections.
2222
/// </summary>
23-
FewestConnections,
23+
LeastConnections,
2424
}
2525
}

0 commit comments

Comments
 (0)