fix issue of multiple file download triggers

This commit is contained in:
rootdarkarchon
2023-08-06 12:09:07 +02:00
parent 48fa74ca80
commit 9307aaecac
2 changed files with 3 additions and 3 deletions

View File

@@ -580,7 +580,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
private List<FileReplacementData> TryCalculateModdedDictionary(Guid applicationBase, CharacterData charaData, out Dictionary<string, string> moddedDictionary, CancellationToken token)
{
Stopwatch st = Stopwatch.StartNew();
List<FileReplacementData> missingFiles = new();
ConcurrentBag<FileReplacementData> missingFiles = new();
moddedDictionary = new Dictionary<string, string>(StringComparer.Ordinal);
ConcurrentDictionary<string, string> outputDict = new(StringComparer.Ordinal);
bool hasMigrationChanges = false;
@@ -634,6 +634,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
if (hasMigrationChanges) _fileDbManager.WriteOutFullCsv();
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);
return missingFiles;
return missingFiles.ToList();
}
}

View File

@@ -188,7 +188,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
Logger.LogDebug("Download start: {id}", gameObjectHandler.Name);
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)));