feat: improve polling recovery and session cleanup
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Diagnostics;
|
||||
using LiveRecorder.Application.Abstractions.Logging;
|
||||
using LiveRecorder.Application.Abstractions.Scripting;
|
||||
using LiveRecorder.Application.Abstractions.Settings;
|
||||
using LiveRecorder.Application.Common;
|
||||
using LiveRecorder.Application.Models.Settings;
|
||||
using LiveRecorder.Domain.Entities;
|
||||
using LiveRecorder.Domain.Enums;
|
||||
@@ -354,6 +355,7 @@ public sealed class EventScriptService : IEventScriptService
|
||||
|
||||
private static Dictionary<string, string> BuildLiveRoomEnvironment(LiveRoom? liveRoom, DateTimeOffset occurredAt)
|
||||
{
|
||||
var localOccurredAt = ChinaTime.ToBeijingTime(occurredAt);
|
||||
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["LIVE_RECORDER_EVENT"] = string.Empty,
|
||||
@@ -363,12 +365,13 @@ public sealed class EventScriptService : IEventScriptService
|
||||
["LIVE_RECORDER_TITLE"] = liveRoom?.Title ?? string.Empty,
|
||||
["LIVE_RECORDER_ANCHOR"] = liveRoom?.AnchorName ?? string.Empty,
|
||||
["LIVE_RECORDER_SOURCE_URL"] = liveRoom?.SourceUrl ?? liveRoom?.NormalizedUrl ?? string.Empty,
|
||||
["LIVE_RECORDER_OCCURRED_AT_UTC"] = occurredAt.ToString("O")
|
||||
["LIVE_RECORDER_OCCURRED_AT_UTC"] = localOccurredAt.ToString("O")
|
||||
};
|
||||
}
|
||||
|
||||
private static IReadOnlyDictionary<string, string> BuildTestEnvironment(string eventName, DateTimeOffset occurredAt)
|
||||
{
|
||||
var localOccurredAt = ChinaTime.ToBeijingTime(occurredAt);
|
||||
var environment = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["LIVE_RECORDER_EVENT"] = eventName,
|
||||
@@ -378,7 +381,7 @@ public sealed class EventScriptService : IEventScriptService
|
||||
["LIVE_RECORDER_TITLE"] = "Sample live title",
|
||||
["LIVE_RECORDER_ANCHOR"] = "Sample anchor",
|
||||
["LIVE_RECORDER_SOURCE_URL"] = "https://live.douyin.com/676493068539",
|
||||
["LIVE_RECORDER_OCCURRED_AT_UTC"] = occurredAt.ToString("O")
|
||||
["LIVE_RECORDER_OCCURRED_AT_UTC"] = localOccurredAt.ToString("O")
|
||||
};
|
||||
|
||||
if (string.Equals(eventName, "segment_completed", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
Reference in New Issue
Block a user