Fix warnings in ServerDbManager (#36871)

Fix warnings in ServerDbManager
This commit is contained in:
Tayrtahn
2025-04-23 19:48:27 -04:00
committed by GitHub
parent acee0e53f7
commit 3313c648fe

View File

@@ -408,6 +408,7 @@ namespace Content.Server.Database
private ServerDbBase _db = default!;
private LoggingProvider _msLogProvider = default!;
private ILoggerFactory _msLoggerFactory = default!;
private ISawmill _sawmill = default!;
private bool _synchronous;
// When running in integration tests, we'll use a single in-memory SQLite database connection.
@@ -423,6 +424,7 @@ namespace Content.Server.Database
{
builder.AddProvider(_msLogProvider);
});
_sawmill = _logMgr.GetSawmill("db.manager");
_synchronous = _cfg.GetCVar(CCVars.DatabaseSynchronous);
@@ -1144,7 +1146,7 @@ namespace Content.Server.Database
Password = pass
}.ConnectionString;
Logger.DebugS("db.manager", $"Using Postgres \"{host}:{port}/{db}\"");
_sawmill.Debug($"Using Postgres \"{host}:{port}/{db}\"");
builder.UseNpgsql(connectionString);
SetupLogging(builder);
@@ -1167,12 +1169,12 @@ namespace Content.Server.Database
if (!inMemory)
{
var finalPreferencesDbPath = Path.Combine(_res.UserData.RootDir!, configPreferencesDbPath);
Logger.DebugS("db.manager", $"Using SQLite DB \"{finalPreferencesDbPath}\"");
_sawmill.Debug($"Using SQLite DB \"{finalPreferencesDbPath}\"");
getConnection = () => new SqliteConnection($"Data Source={finalPreferencesDbPath}");
}
else
{
Logger.DebugS("db.manager", "Using in-memory SQLite DB");
_sawmill.Debug("Using in-memory SQLite DB");
_sqliteInMemoryConnection = new SqliteConnection("Data Source=:memory:");
// When using an in-memory DB we have to open it manually
// so EFCore doesn't open, close and wipe it every operation.