Return AsyncDisposable from DbConnectionFactory

This commit is contained in:
Ske 2020-06-12 00:54:50 +02:00
parent 49acc4d9e2
commit 24f1363bb0

View File

@ -155,7 +155,7 @@ namespace PluralKit.Core
} }
} }
public class PerformanceTrackingConnection: IDbConnection, IAsyncDisposable public class PerformanceTrackingConnection: IAsyncDbConnection
{ {
// Simple delegation of everything. // Simple delegation of everything.
internal NpgsqlConnection _impl; internal NpgsqlConnection _impl;
@ -245,6 +245,11 @@ namespace PluralKit.Core
} }
} }
public interface IAsyncDbConnection: IDbConnection, IAsyncDisposable
{
}
public class DbConnectionFactory public class DbConnectionFactory
{ {
private CoreConfig _config; private CoreConfig _config;
@ -261,7 +266,7 @@ namespace PluralKit.Core
_logger = logger; _logger = logger;
} }
public async Task<IDbConnection> Obtain() public async Task<IAsyncDbConnection> Obtain()
{ {
// Mark the request (for a handle, I guess) in the metrics // Mark the request (for a handle, I guess) in the metrics
_metrics.Measure.Meter.Mark(CoreMetrics.DatabaseRequests); _metrics.Measure.Meter.Mark(CoreMetrics.DatabaseRequests);