fix issue of multiple file download triggers
This commit is contained in:
@@ -580,7 +580,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
private List<FileReplacementData> TryCalculateModdedDictionary(Guid applicationBase, CharacterData charaData, out Dictionary<string, string> moddedDictionary, CancellationToken token)
|
private List<FileReplacementData> TryCalculateModdedDictionary(Guid applicationBase, CharacterData charaData, out Dictionary<string, string> moddedDictionary, CancellationToken token)
|
||||||
{
|
{
|
||||||
Stopwatch st = Stopwatch.StartNew();
|
Stopwatch st = Stopwatch.StartNew();
|
||||||
List<FileReplacementData> missingFiles = new();
|
ConcurrentBag<FileReplacementData> missingFiles = new();
|
||||||
moddedDictionary = new Dictionary<string, string>(StringComparer.Ordinal);
|
moddedDictionary = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
ConcurrentDictionary<string, string> outputDict = new(StringComparer.Ordinal);
|
ConcurrentDictionary<string, string> outputDict = new(StringComparer.Ordinal);
|
||||||
bool hasMigrationChanges = false;
|
bool hasMigrationChanges = false;
|
||||||
@@ -634,6 +634,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
if (hasMigrationChanges) _fileDbManager.WriteOutFullCsv();
|
if (hasMigrationChanges) _fileDbManager.WriteOutFullCsv();
|
||||||
st.Stop();
|
st.Stop();
|
||||||
Logger.LogDebug("[BASE-{appBase}] ModdedPaths calculated in {time}ms, missing files: {count}, total files: {total}", applicationBase, st.ElapsedMilliseconds, missingFiles.Count, moddedDictionary.Keys.Count);
|
Logger.LogDebug("[BASE-{appBase}] ModdedPaths calculated in {time}ms, missing files: {count}, total files: {total}", applicationBase, st.ElapsedMilliseconds, missingFiles.Count, moddedDictionary.Keys.Count);
|
||||||
return missingFiles;
|
return missingFiles.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
|
|||||||
Logger.LogDebug("Download start: {id}", gameObjectHandler.Name);
|
Logger.LogDebug("Download start: {id}", gameObjectHandler.Name);
|
||||||
|
|
||||||
List<DownloadFileDto> downloadFileInfoFromService = new();
|
List<DownloadFileDto> downloadFileInfoFromService = new();
|
||||||
downloadFileInfoFromService.AddRange(await FilesGetSizes(fileReplacement.Select(f => f.Hash).ToList(), ct).ConfigureAwait(false));
|
downloadFileInfoFromService.AddRange(await FilesGetSizes(fileReplacement.Select(f => f.Hash).Distinct(StringComparer.Ordinal).ToList(), ct).ConfigureAwait(false));
|
||||||
|
|
||||||
Logger.LogDebug("Files with size 0 or less: {files}", string.Join(", ", downloadFileInfoFromService.Where(f => f.Size <= 0).Select(f => f.Hash)));
|
Logger.LogDebug("Files with size 0 or less: {files}", string.Join(", ", downloadFileInfoFromService.Where(f => f.Size <= 0).Select(f => f.Hash)));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user