mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Purged a few more Task.Wait() calls
This commit is contained in:
parent
e5aef9a043
commit
eed71e1c24
@ -111,13 +111,13 @@ namespace Wabbajack.CacheServer
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
new Thread(() =>
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
ValidateLists().Wait();
|
||||
await ValidateLists();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -125,9 +125,9 @@ namespace Wabbajack.CacheServer
|
||||
}
|
||||
|
||||
// Sleep for two hours
|
||||
Thread.Sleep(1000 * 60 * 60 * 2);
|
||||
await Task.Delay(1000 * 60 * 60 * 2);
|
||||
}
|
||||
}).Start();
|
||||
}).FireAndForget();
|
||||
}
|
||||
public static async Task ValidateLists()
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
private FileSystemWatcher _watcher;
|
||||
private Subject<FileEvent> _fileEvents = new Subject<FileEvent>();
|
||||
private KnownFolder _downloadfolder;
|
||||
public readonly AsyncLock Lock = new AsyncLock();
|
||||
|
||||
class FileEvent
|
||||
{
|
||||
@ -81,7 +82,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
var downloader = (ManualDownloader)GetDownloader();
|
||||
var absPath = Path.Combine(downloader._downloadfolder.Path, a.Name);
|
||||
lock (downloader)
|
||||
using (await downloader.Lock.Wait())
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -95,8 +96,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
.Select(x => x.FirstOrDefault())
|
||||
.FirstOrDefaultAsync();
|
||||
Process.Start(Url);
|
||||
|
||||
absPath = watcher.Wait()?.FullPath;
|
||||
|
||||
absPath = (await watcher)?.FullPath;
|
||||
if (!File.Exists(absPath))
|
||||
throw new InvalidDataException($"File not found after manual download operation");
|
||||
File.Move(absPath, destination);
|
||||
|
@ -45,11 +45,11 @@ namespace Wabbajack.Test
|
||||
protected async Task<ModList> CompileAndInstall(string profile)
|
||||
{
|
||||
var compiler = await ConfigureAndRunCompiler(profile);
|
||||
Install(compiler);
|
||||
await Install(compiler);
|
||||
return compiler.ModList;
|
||||
}
|
||||
|
||||
protected void Install(MO2Compiler compiler)
|
||||
protected async Task Install(MO2Compiler compiler)
|
||||
{
|
||||
var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile);
|
||||
var installer = new MO2Installer(
|
||||
@ -59,7 +59,7 @@ namespace Wabbajack.Test
|
||||
downloadFolder: utils.DownloadsFolder);
|
||||
installer.WarnOnOverwrite = false;
|
||||
installer.GameFolder = utils.GameFolder;
|
||||
installer.Begin().Wait();
|
||||
await installer.Begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ namespace Wabbajack.Test
|
||||
protected async Task<ModList> CompileAndInstall()
|
||||
{
|
||||
var vortexCompiler = await ConfigureAndRunCompiler();
|
||||
Install(vortexCompiler);
|
||||
await Install(vortexCompiler);
|
||||
return vortexCompiler.ModList;
|
||||
}
|
||||
|
||||
protected void Install(VortexCompiler vortexCompiler)
|
||||
protected async Task Install(VortexCompiler vortexCompiler)
|
||||
{
|
||||
var modList = AInstaller.LoadFromFile(vortexCompiler.ModListOutputFile);
|
||||
var installer = new MO2Installer(
|
||||
@ -71,7 +71,7 @@ namespace Wabbajack.Test
|
||||
{
|
||||
GameFolder = utils.GameFolder,
|
||||
};
|
||||
installer.Begin().Wait();
|
||||
await installer.Begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user