Merge pull request #1642 from cvium/fix_slow_db

Speed up BaseItem deserialization
This commit is contained in:
Joshua M. Boniface 2019-08-18 13:42:08 -04:00 committed by GitHub
commit 4bb0c2d053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1298,20 +1298,15 @@ namespace Emby.Server.Implementations.Data
if (TypeRequiresDeserialization(type)) if (TypeRequiresDeserialization(type))
{ {
using (var stream = new MemoryStream(reader[1].ToBlob()))
{
stream.Position = 0;
try try
{ {
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem; item = _jsonSerializer.DeserializeFromString(reader.GetString(1), type) as BaseItem;
} }
catch (SerializationException ex) catch (SerializationException ex)
{ {
Logger.LogError(ex, "Error deserializing item"); Logger.LogError(ex, "Error deserializing item");
} }
} }
}
if (item == null) if (item == null)
{ {