aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2019-08-18 13:42:08 -0400
committerGitHub <noreply@github.com>2019-08-18 13:42:08 -0400
commit4bb0c2d0532e345f467f6cbee77a78851d26e386 (patch)
tree234a374b5311bfaf375dda2447a7ada496120eb3
parent25a590e8cd5305ea04ecea723e1b1d13a83203ac (diff)
parentf48eaccc5105f0af8f320e0406b95ff868733a50 (diff)
Merge pull request #1642 from cvium/fix_slow_db
Speed up BaseItem deserialization
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs17
1 files changed, 6 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index bb4c34f02..3ca0728fe 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -1298,18 +1298,13 @@ namespace Emby.Server.Implementations.Data
if (TypeRequiresDeserialization(type))
{
- using (var stream = new MemoryStream(reader[1].ToBlob()))
+ try
{
- stream.Position = 0;
-
- try
- {
- item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
- }
- catch (SerializationException ex)
- {
- Logger.LogError(ex, "Error deserializing item");
- }
+ item = _jsonSerializer.DeserializeFromString(reader.GetString(1), type) as BaseItem;
+ }
+ catch (SerializationException ex)
+ {
+ Logger.LogError(ex, "Error deserializing item");
}
}