This commit adds support to allow the LANCommander server to scale horizontally. Multiple instances of the application can be deployed for load-balancing purposes. This will require a load balancer in front of the instances, as well as either MySQL or PostgreSQL and a Redis cache.
14 lines
501 B
C#
14 lines
501 B
C#
using LANCommander.Server.Services.Abstractions;
|
|
|
|
namespace LANCommander.Server.Services;
|
|
|
|
/// <summary>
|
|
/// Default <see cref="ICoordinatorElection"/> used when horizontal scaling is disabled. There is
|
|
/// only one instance, so it is always the coordinator.
|
|
/// </summary>
|
|
public sealed class SingleInstanceCoordinatorElection : ICoordinatorElection
|
|
{
|
|
public bool IsLeader => true;
|
|
|
|
public Task<bool> TryAcquireAsync(CancellationToken cancellationToken = default) => Task.FromResult(true);
|
|
}
|