Fix memory leak in GameServer (#731)

* Convert entities to serializable after aggregating rather before

* Cache instances of CustomXmlSerializer and create readonly constants for reused settings

* Change CustomXmlSerializer and serializer cache to work with deserializer
This commit is contained in:
Josh 2023-04-02 18:45:19 -05:00 committed by GitHub
parent 0253864f5e
commit 2210541894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 125 additions and 147 deletions

View file

@ -61,10 +61,10 @@ public class SearchController : ControllerBase
s.SlotId.ToString().Equals(keyword)
);
List<SlotBase> slots = await dbQuery.Skip(Math.Max(0, pageStart - 1))
List<SlotBase> slots = (await dbQuery.Skip(Math.Max(0, pageStart - 1))
.Take(Math.Min(pageSize, 30))
.Select(s => SlotBase.CreateFromEntity(s, token))
.ToListAsync();
.ToListAsync())
.ToSerializableList(s => SlotBase.CreateFromEntity(s, token));
return this.Ok(new GenericSlotResponse(keyName, slots, await dbQuery.CountAsync(), 0));
}