Skip to content

Commit

Permalink
Whops we "deadlocked" the app, ensure to release lock
Browse files Browse the repository at this point in the history
  • Loading branch information
bcssov committed Jul 28, 2022
1 parent baf070c commit 0f67961
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions src/IronyModManager.IO/Mods/Exporter/SQLiteExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created : 08-11-2020
//
// Last Modified By : Mario
// Last Modified On : 01-16-2022
// Last Modified On : 07-28-2022
// ***********************************************************************
// <copyright file="SQLiteExporter.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -90,37 +90,43 @@ public SQLiteExporter(ILogger logger, bool exportBeta)
public async Task<bool> ExportAsync(ModWriterParameters parameters)
{
var mutex = await exportLock.LockAsync();
// Caching sucks in this ORM
DbFieldCache.Flush();
FieldCache.Flush();
IdentityCache.Flush();
PrimaryCache.Flush();
EnsureDbExists(parameters);
var version = await GetVersionAsync(parameters);
switch (version)
try
{
case Version.v3:
{
var collection = await RecreateCollectionV3Async(parameters);
await SyncModsV2Async(collection, parameters);
}
break;
// Caching sucks in this ORM
DbFieldCache.Flush();
FieldCache.Flush();
IdentityCache.Flush();
PrimaryCache.Flush();
EnsureDbExists(parameters);
var version = await GetVersionAsync(parameters);
switch (version)
{
case Version.v3:
{
var collection = await RecreateCollectionV3Async(parameters);
await SyncModsV2Async(collection, parameters);
}
break;

case Version.v4:
{
var collection = await RecreateCollectionV4Async(parameters);
await SyncModsV4Async(collection, parameters);
}
break;
case Version.v4:
{
var collection = await RecreateCollectionV4Async(parameters);
await SyncModsV4Async(collection, parameters);
}
break;

default:
{
var collection = await RecreateCollectionV2Async(parameters);
await SyncModsV2Async(collection, parameters);
}
break;
default:
{
var collection = await RecreateCollectionV2Async(parameters);
await SyncModsV2Async(collection, parameters);
}
break;
}
}
finally
{
mutex.Dispose();
}
mutex.Dispose();
return true;
}

Expand Down

0 comments on commit 0f67961

Please sign in to comment.