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