aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-11-21 12:29:18 -0500
committerGitHub <noreply@github.com>2016-11-21 12:29:18 -0500
commitf80cc1bbd4145a682234d4d1d286c70f562f36bd (patch)
tree2ecc0e11aa1f394295f6269069da5ed6b9ed0667 /Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
parentb2ea3272e70a0f520133ee6a74d958e044d4392e (diff)
parent1acebd992229ee9bd6e7677f68174672fae53622 (diff)
Merge pull request #2299 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs')
-rw-r--r--Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs28
1 files changed, 18 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
index 5a3b64dbb..66ef5d5d1 100644
--- a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
+++ b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
@@ -29,7 +29,15 @@ namespace Emby.Server.Implementations.Notifications
{
using (var connection = CreateConnection())
{
+ connection.ExecuteAll(string.Join(";", new[]
+ {
+ "PRAGMA page_size=4096",
+ "pragma default_temp_store = memory",
+ "pragma temp_store = memory"
+ }));
+
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)"
@@ -48,9 +56,9 @@ namespace Emby.Server.Implementations.Notifications
{
var result = new NotificationResult();
- using (WriteLock.Read())
+ using (var connection = CreateConnection(true))
{
- using (var connection = CreateConnection(true))
+ //using (WriteLock.Read())
{
var clauses = new List<string>();
var paramList = new List<object>();
@@ -103,9 +111,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 +228,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 +291,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 +313,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 =>
{