baa16b6586
Cleanup never matched a live session because the controller registered empty manifest and segment paths, renewal was a read-modify-write that could revert a takeover, and the takeover script compared an ISO date to a number, so it errored. - populate the session record's manifest and segment paths from the playlist path - renew the lease via a Lua compare-and-set on the owning pod - store the lease expiry as unix milliseconds so the scripts can compare it - retain the session record past its lease so an orphan can still be taken over - test the Redis store against a real Redis, including the renew-vs-takeover race - drop the live stream record nothing ever read back
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Controller.MediaEncoding;
|
|
|
|
/// <summary>
|
|
/// A no-op implementation of <see cref="ITranscodeSessionStore"/> used in single-instance deployments
|
|
/// where durable session tracking across pods is not required.
|
|
/// </summary>
|
|
public sealed class NullTranscodeSessionStore : ITranscodeSessionStore
|
|
{
|
|
/// <inheritdoc />
|
|
public Task<TranscodeSession?> TryGetAsync(string playSessionId, CancellationToken cancellationToken = default)
|
|
=> Task.FromResult<TranscodeSession?>(null);
|
|
|
|
/// <inheritdoc />
|
|
public Task<bool> TryTakeoverAsync(string playSessionId, string claimingPod, CancellationToken cancellationToken = default)
|
|
=> Task.FromResult(false);
|
|
|
|
/// <inheritdoc />
|
|
public Task SetAsync(TranscodeSession session, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
|
|
/// <inheritdoc />
|
|
public Task<bool> RenewLeaseAsync(string playSessionId, string ownerPod, CancellationToken cancellationToken = default)
|
|
=> Task.FromResult(true);
|
|
|
|
/// <inheritdoc />
|
|
public Task DeleteAsync(string playSessionId, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
|
|
/// <inheritdoc />
|
|
public Task<IEnumerable<TranscodeSession>> GetActiveSessionsAsync(CancellationToken cancellationToken = default)
|
|
=> Task.FromResult<IEnumerable<TranscodeSession>>(Array.Empty<TranscodeSession>());
|
|
}
|