9e66708d87
Ownership is claimed with a Lua check-and-set keyed on the instance holding the websocket, routing prefers a live controller over a local copy, the session list deduplicates by owner, removal is ownership-checked, undelivered routed messages surface, single-session lookups stop scanning the keyspace and directory writes leave the request path bounded by a timeout.
29 lines
786 B
C#
29 lines
786 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Controller.Session;
|
|
|
|
/// <summary>
|
|
/// The single-instance <see cref="IPodMessageBus"/>: there is no other instance to reach.
|
|
/// </summary>
|
|
public sealed class NullPodMessageBus : IPodMessageBus
|
|
{
|
|
/// <summary>
|
|
/// Gets the shared instance.
|
|
/// </summary>
|
|
public static NullPodMessageBus Instance { get; } = new NullPodMessageBus();
|
|
|
|
/// <inheritdoc />
|
|
public string PodId => PodIdentity.Current;
|
|
|
|
/// <inheritdoc />
|
|
public Task<long> PublishAsync(string targetPod, PodMessage message, CancellationToken cancellationToken = default)
|
|
=> Task.FromResult(0L);
|
|
|
|
/// <inheritdoc />
|
|
public void Subscribe(Func<PodMessage, Task> handler)
|
|
{
|
|
}
|
|
}
|