aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-20 22:52:58 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-20 22:52:58 -0500
commit1dc080df8ba5b9af9245788634d56cb155afd2ba (patch)
tree746452b0013f05987fa35dd404f040cca60dcf58 /Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
parent985c9111cf14431c3e1a1f94953a6d4422d167ee (diff)
update connections
Diffstat (limited to 'Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs')
-rw-r--r--Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs25
1 files changed, 17 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
index 5a3b64dbb..5fc691527 100644
--- a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
+++ b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
@@ -29,7 +29,16 @@ namespace Emby.Server.Implementations.Notifications
{
using (var connection = CreateConnection())
{
+ connection.ExecuteAll(string.Join(";", new[]
+ {
+ "pragma default_temp_store = memory",
+ "pragma default_synchronous=Normal",
+ "pragma temp_store = memory",
+ "pragma synchronous=Normal",
+ }));
+
string[] queries = {
+
"create table if not exists Notifications (Id GUID NOT NULL, UserId GUID NOT NULL, Date DATETIME NOT NULL, Name TEXT NOT NULL, Description TEXT NULL, Url TEXT NULL, Level TEXT NOT NULL, IsRead BOOLEAN NOT NULL, Category TEXT NOT NULL, RelatedId TEXT NULL, PRIMARY KEY (Id, UserId))",
"create index if not exists idx_Notifications1 on Notifications(Id)",
"create index if not exists idx_Notifications2 on Notifications(UserId)"
@@ -103,9 +112,9 @@ namespace Emby.Server.Implementations.Notifications
{
var result = new NotificationsSummary();
- using (WriteLock.Read())
+ using (var connection = CreateConnection(true))
{
- using (var connection = CreateConnection(true))
+ using (WriteLock.Read())
{
using (var statement = connection.PrepareStatement("select Level from Notifications where UserId=@UserId and IsRead=@IsRead"))
{
@@ -220,9 +229,9 @@ namespace Emby.Server.Implementations.Notifications
cancellationToken.ThrowIfCancellationRequested();
- using (WriteLock.Write())
+ using (var connection = CreateConnection())
{
- using (var connection = CreateConnection())
+ using (WriteLock.Write())
{
connection.RunInTransaction(conn =>
{
@@ -283,9 +292,9 @@ namespace Emby.Server.Implementations.Notifications
{
cancellationToken.ThrowIfCancellationRequested();
- using (WriteLock.Write())
+ using (var connection = CreateConnection())
{
- using (var connection = CreateConnection())
+ using (WriteLock.Write())
{
connection.RunInTransaction(conn =>
{
@@ -305,9 +314,9 @@ namespace Emby.Server.Implementations.Notifications
{
cancellationToken.ThrowIfCancellationRequested();
- using (WriteLock.Write())
+ using (var connection = CreateConnection())
{
- using (var connection = CreateConnection())
+ using (WriteLock.Write())
{
connection.RunInTransaction(conn =>
{