Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.9.9.48 #809

Merged
merged 6 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Daybreak.GWCA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif()
set(VERSION_MAJOR 0)
set(VERSION_MINOR 9)
set(VERSION_PATCH 9)
set(VERSION_TWEAK 47)
set(VERSION_TWEAK 48)

set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
Expand Down
4 changes: 2 additions & 2 deletions Daybreak.Tests/Daybreak.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion Daybreak/Configuration/ProjectConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public override void RegisterStartupActions(IStartupActionProducer startupAction
startupActionProducer.RegisterAction<FixPriceHistoryEntries>();
startupActionProducer.RegisterAction<CredentialsOptionsMigrator>();
startupActionProducer.RegisterAction<BrowserHistorySizeEnforcer>();
startupActionProducer.RegisterAction<CleanupDatabases>();
}

public override void RegisterPostUpdateActions(IPostUpdateActionProducer postUpdateActionProducer)
Expand Down Expand Up @@ -401,14 +402,14 @@ public override void RegisterNotificationHandlers(INotificationHandlerProducer n

public override void RegisterMods(IModsManager modsManager)
{
modsManager.RegisterMod<IGuildWarsVersionChecker, GuildWarsVersionChecker>();
modsManager.RegisterMod<IReShadeService, ReShadeService>();
modsManager.RegisterMod<IUModService, UModService>();
modsManager.RegisterMod<IToolboxService, ToolboxService>();
modsManager.RegisterMod<IDSOALService, DSOALService>();
modsManager.RegisterMod<IGuildwarsScreenPlacer, GuildwarsScreenPlacer>();
modsManager.RegisterMod<IGWCAInjector, GWCAInjector>();
modsManager.RegisterMod<IDirectSongService, DirectSongService>(singleton: true);
modsManager.RegisterMod<IGuildWarsVersionChecker, GuildWarsVersionChecker>();
}

public override void RegisterBrowserExtensions(IBrowserExtensionsProducer browserExtensionsProducer)
Expand Down
2 changes: 1 addition & 1 deletion Daybreak/Daybreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>preview</LangVersion>
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<Version>0.9.9.47</Version>
<Version>0.9.9.48</Version>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<UserSecretsId>cfb2a489-db80-448d-a969-80270f314c46</UserSecretsId>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand Down
60 changes: 60 additions & 0 deletions Daybreak/Services/Startup/Actions/CleanupDatabases.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Daybreak.Services.Notifications.Models;
using Daybreak.Services.TradeChat.Models;
using LiteDB;
using Microsoft.Extensions.Logging;
using System.Core.Extensions;
using System.Extensions;
using System.Threading;
using System.Threading.Tasks;

namespace Daybreak.Services.Startup.Actions;
public sealed class CleanupDatabases : StartupActionBase
{
private readonly ILiteCollection<Models.Log> loggingCollection;
private readonly ILiteCollection<TraderQuoteDTO> quotesCollection;
private readonly ILiteCollection<NotificationDTO> notificationsCollection;
private readonly ILiteCollection<TraderMessageDTO> traderMessagesCollection;
private readonly ILogger<CleanupDatabases> logger;

public CleanupDatabases(
ILiteCollection<Models.Log> loggingCollection,
ILiteCollection<TraderQuoteDTO> quotesCollection,
ILiteCollection<NotificationDTO> notificationsCollection,
ILiteCollection<TraderMessageDTO> traderMessagesCollection,
ILogger<CleanupDatabases> logger)
{
this.loggingCollection = loggingCollection.ThrowIfNull();
this.quotesCollection = quotesCollection.ThrowIfNull();
this.notificationsCollection = notificationsCollection.ThrowIfNull();
this.traderMessagesCollection = traderMessagesCollection.ThrowIfNull();
this.logger = logger.ThrowIfNull();
}

public override void ExecuteOnStartup()
{
var scopedLogger = this.logger.CreateScopedLogger(nameof(this.ExecuteOnStartup), string.Empty);
if (this.loggingCollection.LongCount() > 50000)
{
this.loggingCollection.DeleteAll();
scopedLogger.LogInformation("Cleared logging database");
}

if (this.notificationsCollection.LongCount() > 1000)
{
this.notificationsCollection.DeleteAll();
scopedLogger.LogInformation("Cleared notifications database");
}

if (this.quotesCollection.LongCount() > 1000)
{
this.quotesCollection.DeleteAll();
scopedLogger.LogInformation("Cleared quotes database");
}

if (this.traderMessagesCollection.LongCount() > 1000)
{
this.traderMessagesCollection.DeleteAll();
scopedLogger.LogInformation("Cleared trader messages database");
}
}
}
Loading