mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix race condition with Do and async
This commit is contained in:
parent
b2a112bd37
commit
1099d68ef7
@ -300,6 +300,17 @@ namespace Wabbajack.Common
|
||||
{
|
||||
foreach (var i in coll) f(i);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the action for every item in coll
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="coll"></param>
|
||||
/// <param name="f"></param>
|
||||
public static async Task DoAsync<T>(this IEnumerable<T> coll, Func<T, Task> f)
|
||||
{
|
||||
foreach (var i in coll) await f(i);
|
||||
}
|
||||
|
||||
public static void DoIndexed<T>(this IEnumerable<T> coll, Action<int, T> f)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ namespace Wabbajack.VirtualFileSystem
|
||||
bw.Write(FileVersion);
|
||||
bw.Write((ulong) Index.AllFiles.Count);
|
||||
|
||||
(await Index.AllFiles
|
||||
await (await Index.AllFiles
|
||||
.PMap(Queue, f =>
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
@ -156,7 +156,7 @@ namespace Wabbajack.VirtualFileSystem
|
||||
f.Write(ibw);
|
||||
return ms;
|
||||
}))
|
||||
.Do(async ms =>
|
||||
.DoAsync(async ms =>
|
||||
{
|
||||
var size = ms.Position;
|
||||
ms.Position = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user