diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-02-26 18:30:13 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2019-06-28 12:12:54 +0200 |
| commit | c30ba14c1f9701638bbb47e81d3e7027cb778135 (patch) | |
| tree | 608448e86e00ab4fd3ed06adb7bf1147ad4a2f7f /Emby.Server.Implementations/Activity/ActivityRepository.cs | |
| parent | cec22ad10daf7abef2f27f846e4022d5a35faccf (diff) | |
Use a connection pool instead of creating new connections
Diffstat (limited to 'Emby.Server.Implementations/Activity/ActivityRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Activity/ActivityRepository.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs index 495d96977..a38cb38d7 100644 --- a/Emby.Server.Implementations/Activity/ActivityRepository.cs +++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs @@ -43,7 +43,8 @@ namespace Emby.Server.Implementations.Activity private void InitializeInternal() { - using (var connection = CreateConnection()) + CreateConnections().GetAwaiter().GetResult(); + using (var connection = GetConnection()) { RunDefaultInitialization(connection); @@ -57,7 +58,7 @@ namespace Emby.Server.Implementations.Activity } } - private void TryMigrate(SQLiteDatabaseConnection connection) + private void TryMigrate(ManagedConnection connection) { try { @@ -85,7 +86,7 @@ namespace Emby.Server.Implementations.Activity throw new ArgumentNullException(nameof(entry)); } - using (var connection = CreateConnection()) + using (var connection = GetConnection()) { connection.RunInTransaction(db => { @@ -123,7 +124,7 @@ namespace Emby.Server.Implementations.Activity throw new ArgumentNullException(nameof(entry)); } - using (var connection = CreateConnection()) + using (var connection = GetConnection()) { connection.RunInTransaction(db => { @@ -157,7 +158,7 @@ namespace Emby.Server.Implementations.Activity public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? startIndex, int? limit) { - using (var connection = CreateConnection(true)) + using (var connection = GetConnection(true)) { var commandText = BaseActivitySelectText; var whereClauses = new List<string>(); |
