mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #702 from Noggog/missing-prepare-awaits
Missing IDownloader.Prepare awaits
This commit is contained in:
commit
ff2397b48b
@ -44,7 +44,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
||||
return JobResult.Success();
|
||||
}
|
||||
|
||||
private async Task ValidateList(SqlService sql, ModlistMetadata list, WorkQueue queue, ValidateModlist whitelists)
|
||||
private async Task ValidateList(SqlService sql, ModlistMetadata list, WorkQueue queue, ValidateModlist whitelists)
|
||||
{
|
||||
var modlistPath = Consts.ModListDownloadFolder.Combine(list.Links.MachineURL + Consts.ModListExtension);
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
||||
|
||||
Utils.Log($"{installer.Archives.Count} archives to validate");
|
||||
|
||||
DownloadDispatcher.PrepareAll(installer.Archives.Select(a => a.State));
|
||||
await DownloadDispatcher.PrepareAll(installer.Archives.Select(a => a.State));
|
||||
|
||||
|
||||
var validated = (await installer.Archives
|
||||
|
@ -24,7 +24,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
if (state == null)
|
||||
return CLIUtils.Exit($"Could not find download source for URL {Url}", ExitCode.Error);
|
||||
|
||||
DownloadDispatcher.PrepareAll(new []{state});
|
||||
await DownloadDispatcher.PrepareAll(new []{state});
|
||||
|
||||
using var queue = new WorkQueue();
|
||||
queue.Status
|
||||
|
@ -58,7 +58,6 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public static T GetInstance<T>() where T : IDownloader
|
||||
{
|
||||
var inst = (T)IndexedDownloaders[typeof(T)];
|
||||
inst.Prepare();
|
||||
return inst;
|
||||
}
|
||||
|
||||
@ -79,11 +78,11 @@ namespace Wabbajack.Lib.Downloaders
|
||||
return Downloaders.OfType<IUrlDownloader>().Select(d => d.GetDownloaderState(url)).FirstOrDefault(result => result != null);
|
||||
}
|
||||
|
||||
public static void PrepareAll(IEnumerable<AbstractDownloadState> states)
|
||||
public static async Task PrepareAll(IEnumerable<AbstractDownloadState> states)
|
||||
{
|
||||
states.Select(s => s.GetDownloader().GetType())
|
||||
await Task.WhenAll(states.Select(s => s.GetDownloader().GetType())
|
||||
.Distinct()
|
||||
.Do(t => Downloaders.First(d => d.GetType() == t).Prepare());
|
||||
.Select(t => Downloaders.First(d => d.GetType() == t).Prepare()));
|
||||
}
|
||||
|
||||
public static async Task<bool> DownloadWithPossibleUpgrade(Archive archive, AbsolutePath destination)
|
||||
|
@ -44,9 +44,9 @@ namespace Wabbajack.Test
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestAllPrepares()
|
||||
public async Task TestAllPrepares()
|
||||
{
|
||||
DownloadDispatcher.Downloaders.Do(d => d.Prepare());
|
||||
await Task.WhenAll(DownloadDispatcher.Downloaders.Select(d => d.Prepare()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Loading…
Reference in New Issue
Block a user