mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #11361 from Bond-009/nope
Properly await Task.Delay()
This commit is contained in:
commit
0b15352771
@ -1481,7 +1481,7 @@ public class DynamicHlsController : BaseJellyfinApiController
|
|||||||
|
|
||||||
if (currentTranscodingIndex.HasValue)
|
if (currentTranscodingIndex.HasValue)
|
||||||
{
|
{
|
||||||
DeleteLastFile(playlistPath, segmentExtension, 0);
|
await DeleteLastFile(playlistPath, segmentExtension, 0).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
streamingRequest.StartTimeTicks = streamingRequest.CurrentRuntimeTicks;
|
streamingRequest.StartTimeTicks = streamingRequest.CurrentRuntimeTicks;
|
||||||
@ -2009,17 +2009,19 @@ public class DynamicHlsController : BaseJellyfinApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteLastFile(string playlistPath, string segmentExtension, int retryCount)
|
private Task DeleteLastFile(string playlistPath, string segmentExtension, int retryCount)
|
||||||
{
|
{
|
||||||
var file = GetLastTranscodingFile(playlistPath, segmentExtension, _fileSystem);
|
var file = GetLastTranscodingFile(playlistPath, segmentExtension, _fileSystem);
|
||||||
|
|
||||||
if (file is not null)
|
if (file is null)
|
||||||
{
|
{
|
||||||
DeleteFile(file.FullName, retryCount);
|
return Task.CompletedTask;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteFile(string path, int retryCount)
|
return DeleteFile(file.FullName, retryCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteFile(string path, int retryCount)
|
||||||
{
|
{
|
||||||
if (retryCount >= 5)
|
if (retryCount >= 5)
|
||||||
{
|
{
|
||||||
@ -2036,9 +2038,8 @@ public class DynamicHlsController : BaseJellyfinApiController
|
|||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
|
_logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
|
||||||
|
|
||||||
var task = Task.Delay(100);
|
await Task.Delay(100).ConfigureAwait(false);
|
||||||
task.Wait();
|
await DeleteFile(path, retryCount + 1).ConfigureAwait(false);
|
||||||
DeleteFile(path, retryCount + 1);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user