Merge pull request #1642 from cvium/fix_slow_db
Speed up BaseItem deserialization
This commit is contained in:
commit
4bb0c2d053
|
@ -1298,18 +1298,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
if (TypeRequiresDeserialization(type))
|
if (TypeRequiresDeserialization(type))
|
||||||
{
|
{
|
||||||
using (var stream = new MemoryStream(reader[1].ToBlob()))
|
try
|
||||||
{
|
{
|
||||||
stream.Position = 0;
|
item = _jsonSerializer.DeserializeFromString(reader.GetString(1), type) as BaseItem;
|
||||||
|
}
|
||||||
try
|
catch (SerializationException ex)
|
||||||
{
|
{
|
||||||
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
|
Logger.LogError(ex, "Error deserializing item");
|
||||||
}
|
|
||||||
catch (SerializationException ex)
|
|
||||||
{
|
|
||||||
Logger.LogError(ex, "Error deserializing item");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user