mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Missing IDownloader.Prepare awaits
This commit is contained in:
parent
18d5f56f52
commit
482b7f9c9e
@ -44,7 +44,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
|||||||
return JobResult.Success();
|
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);
|
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");
|
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
|
var validated = (await installer.Archives
|
||||||
|
@ -24,7 +24,7 @@ namespace Wabbajack.CLI.Verbs
|
|||||||
if (state == null)
|
if (state == null)
|
||||||
return CLIUtils.Exit($"Could not find download source for URL {Url}", ExitCode.Error);
|
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();
|
using var queue = new WorkQueue();
|
||||||
queue.Status
|
queue.Status
|
||||||
|
@ -58,7 +58,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
public static T GetInstance<T>() where T : IDownloader
|
public static T GetInstance<T>() where T : IDownloader
|
||||||
{
|
{
|
||||||
var inst = (T)IndexedDownloaders[typeof(T)];
|
var inst = (T)IndexedDownloaders[typeof(T)];
|
||||||
inst.Prepare();
|
inst.Prepare().FireAndForget();
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +79,11 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
return Downloaders.OfType<IUrlDownloader>().Select(d => d.GetDownloaderState(url)).FirstOrDefault(result => result != null);
|
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()
|
.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)
|
public static async Task<bool> DownloadWithPossibleUpgrade(Archive archive, AbsolutePath destination)
|
||||||
|
@ -44,9 +44,9 @@ namespace Wabbajack.Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestAllPrepares()
|
public async Task TestAllPrepares()
|
||||||
{
|
{
|
||||||
DownloadDispatcher.Downloaders.Do(d => d.Prepare());
|
await Task.WhenAll(DownloadDispatcher.Downloaders.Select(d => d.Prepare()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
Reference in New Issue
Block a user