1
Fork 0
mirror of https://gitlab.com/Kwoth/nadekobot.git synced 2024-10-02 20:13:13 +00:00

fix: Fixed claimed waifu decay that was introduced in a recent patch

dev: Cleaned up a little bit in medusa loading. Clean medusa unloading will be broken for a while probably
This commit is contained in:
Kwoth 2024-09-23 18:18:38 +00:00
parent a362ee90fc
commit 716e092fd0
2 changed files with 27 additions and 15 deletions

View file

@ -577,7 +577,7 @@ public class WaifuService : INService, IReadyExecutor
{
await using var uow = _db.GetDbContext();
await uow.GetTable<WaifuInfo>()
.Where(x => x.Price > minPrice && x.ClaimerId == null)
.Where(x => x.Price > minPrice && x.ClaimerId != null)
.UpdateAsync(old => new()
{
Price = (long)(old.Price * claimedMulti)

View file

@ -250,6 +250,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
}
catch (Exception ex) when (ex is FileNotFoundException or BadImageFormatException)
{
Log.Error(ex, "An error occurred loading a medusa");
return MedusaLoadResult.NotFound;
}
catch (Exception ex)
@ -334,7 +335,10 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
// ctx.LoadDependencies(a);
iocModule = null;
// load services
try
{
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);
iocModule.Load();
@ -344,6 +348,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
if (sis.Count == 0)
{
iocModule.Unload();
ctx.Unload();
return false;
}
@ -352,6 +357,13 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
return true;
}
catch
{
iocModule?.Unload();
ctx.Unload();
throw;
}
}
private static readonly Type _paramParserType = typeof(ParamParser<>);