check cold storage outside of download task instead
This commit is contained in:
@@ -55,9 +55,6 @@ public sealed class CachedFileProvider : IDisposable
|
|||||||
{
|
{
|
||||||
var destinationFilePath = FilePathUtil.GetFilePath(_hotStoragePath, hash);
|
var destinationFilePath = FilePathUtil.GetFilePath(_hotStoragePath, hash);
|
||||||
|
|
||||||
// first check cold storage
|
|
||||||
if (TryCopyFromColdStorage(hash, destinationFilePath)) return;
|
|
||||||
|
|
||||||
// if cold storage is not configured or file not found or error is present try to download file from remote
|
// if cold storage is not configured or file not found or error is present try to download file from remote
|
||||||
var downloadUrl = MareFiles.DistributionGetFullPath(_remoteCacheSourceUri, hash);
|
var downloadUrl = MareFiles.DistributionGetFullPath(_remoteCacheSourceUri, hash);
|
||||||
_logger.LogInformation("Did not find {hash}, downloading from {server}", hash, downloadUrl);
|
_logger.LogInformation("Did not find {hash}, downloading from {server}", hash, downloadUrl);
|
||||||
@@ -134,9 +131,9 @@ public sealed class CachedFileProvider : IDisposable
|
|||||||
public async Task DownloadFileWhenRequired(string hash)
|
public async Task DownloadFileWhenRequired(string hash)
|
||||||
{
|
{
|
||||||
var fi = FilePathUtil.GetFileInfoForHash(_hotStoragePath, hash);
|
var fi = FilePathUtil.GetFileInfoForHash(_hotStoragePath, hash);
|
||||||
if (fi == null && IsMainServer)
|
if (fi == null)
|
||||||
{
|
{
|
||||||
TryCopyFromColdStorage(hash, FilePathUtil.GetFilePath(_hotStoragePath, hash));
|
if (TryCopyFromColdStorage(hash, FilePathUtil.GetFilePath(_hotStoragePath, hash)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user