High-latency DB testing stuff (#22282)
This commit is contained in:
committed by
GitHub
parent
b457ce779a
commit
46e36934a6
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -20,6 +21,14 @@ namespace Content.Server.Database
|
||||
{
|
||||
public abstract class ServerDbBase
|
||||
{
|
||||
private readonly ISawmill _opsLog;
|
||||
|
||||
/// <param name="opsLog">Sawmill to trace log database operations to.</param>
|
||||
public ServerDbBase(ISawmill opsLog)
|
||||
{
|
||||
_opsLog = opsLog;
|
||||
}
|
||||
|
||||
#region Preferences
|
||||
public async Task<PlayerPreferences?> GetPlayerPreferencesAsync(NetUserId userId)
|
||||
{
|
||||
@@ -1375,7 +1384,12 @@ INSERT INTO player_round (players_id, rounds_id) VALUES ({players[player]}, {id}
|
||||
|
||||
#endregion
|
||||
|
||||
protected abstract Task<DbGuard> GetDb();
|
||||
protected abstract Task<DbGuard> GetDb([CallerMemberName] string? name = null);
|
||||
|
||||
protected void LogDbOp(string? name)
|
||||
{
|
||||
_opsLog.Verbose($"Running DB operation: {name ?? "unknown"}");
|
||||
}
|
||||
|
||||
protected abstract class DbGuard : IAsyncDisposable
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user