mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04: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:
@@ -577,7 +577,7 @@ public class WaifuService : INService, IReadyExecutor
|
|||||||
{
|
{
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
await uow.GetTable<WaifuInfo>()
|
await uow.GetTable<WaifuInfo>()
|
||||||
.Where(x => x.Price > minPrice && x.ClaimerId == null)
|
.Where(x => x.Price > minPrice && x.ClaimerId != null)
|
||||||
.UpdateAsync(old => new()
|
.UpdateAsync(old => new()
|
||||||
{
|
{
|
||||||
Price = (long)(old.Price * claimedMulti)
|
Price = (long)(old.Price * claimedMulti)
|
||||||
|
@@ -250,6 +250,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is FileNotFoundException or BadImageFormatException)
|
catch (Exception ex) when (ex is FileNotFoundException or BadImageFormatException)
|
||||||
{
|
{
|
||||||
|
Log.Error(ex, "An error occurred loading a medusa");
|
||||||
return MedusaLoadResult.NotFound;
|
return MedusaLoadResult.NotFound;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -334,23 +335,34 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
|||||||
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
|
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
|
||||||
// ctx.LoadDependencies(a);
|
// ctx.LoadDependencies(a);
|
||||||
|
|
||||||
|
iocModule = null;
|
||||||
// load services
|
// load services
|
||||||
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);
|
try
|
||||||
iocModule.Load();
|
|
||||||
|
|
||||||
var sis = LoadSneksFromAssembly(safeName, a);
|
|
||||||
typeReaders = LoadTypeReadersFromAssembly(a, strings);
|
|
||||||
|
|
||||||
if (sis.Count == 0)
|
|
||||||
{
|
{
|
||||||
iocModule.Unload();
|
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);
|
||||||
return false;
|
iocModule.Load();
|
||||||
|
|
||||||
|
var sis = LoadSneksFromAssembly(safeName, a);
|
||||||
|
typeReaders = LoadTypeReadersFromAssembly(a, strings);
|
||||||
|
|
||||||
|
if (sis.Count == 0)
|
||||||
|
{
|
||||||
|
iocModule.Unload();
|
||||||
|
ctx.Unload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctxWr = new(ctx);
|
||||||
|
snekData = sis;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
iocModule?.Unload();
|
||||||
|
ctx.Unload();
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxWr = new(ctx);
|
|
||||||
snekData = sis;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Type _paramParserType = typeof(ParamParser<>);
|
private static readonly Type _paramParserType = typeof(ParamParser<>);
|
||||||
|
Reference in New Issue
Block a user