mirror of
https://github.com/Stone-Red-Code/RemoteExec.git
synced 2026-09-04 00:56:17 +02:00
14 lines
420 B
C#
14 lines
420 B
C#
namespace RemoteExec.Client.LoadBalancingStrategies;
|
|
|
|
/// <summary>
|
|
/// A load balancing strategy that selects servers based on local backlog.
|
|
/// </summary>
|
|
public class LeastBacklogStrategy : ILoadBalancingStrategy
|
|
{
|
|
/// <inheritdoc/>
|
|
public ServerConnection? SelectServer(IEnumerable<ServerConnection> availableServers)
|
|
{
|
|
return availableServers.MinBy(s => s.TaskChannel.Reader.Count);
|
|
}
|
|
}
|