mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Fix: Update last access time for cached files to enable proper cleanup
This commit is contained in:
@@ -811,6 +811,16 @@ public class JellyfinController : ControllerBase
|
|||||||
|
|
||||||
if (localPath != null && System.IO.File.Exists(localPath))
|
if (localPath != null && System.IO.File.Exists(localPath))
|
||||||
{
|
{
|
||||||
|
// Update last access time for cache cleanup
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.IO.File.SetLastAccessTimeUtc(localPath, DateTime.UtcNow);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Failed to update last access time for {Path}", localPath);
|
||||||
|
}
|
||||||
|
|
||||||
var stream = System.IO.File.OpenRead(localPath);
|
var stream = System.IO.File.OpenRead(localPath);
|
||||||
return File(stream, GetContentType(localPath), enableRangeProcessing: true);
|
return File(stream, GetContentType(localPath), enableRangeProcessing: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,16 @@ public class SubsonicController : ControllerBase
|
|||||||
|
|
||||||
if (localPath != null && System.IO.File.Exists(localPath))
|
if (localPath != null && System.IO.File.Exists(localPath))
|
||||||
{
|
{
|
||||||
|
// Update last access time for cache cleanup
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.IO.File.SetLastAccessTimeUtc(localPath, DateTime.UtcNow);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Failed to update last access time for {Path}", localPath);
|
||||||
|
}
|
||||||
|
|
||||||
var stream = System.IO.File.OpenRead(localPath);
|
var stream = System.IO.File.OpenRead(localPath);
|
||||||
return File(stream, GetContentType(localPath), enableRangeProcessing: true);
|
return File(stream, GetContentType(localPath), enableRangeProcessing: true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user