From 854ac06de6f98409e2064e163c48b9d5a6e07cf7 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Thu, 16 Nov 2023 12:23:22 +0100 Subject: [PATCH] chore: slight adjustments to async --- Server/AuthSession.cs | 6 +++--- Server/PacketHandlers/CharacterCreationHandler..cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Server/AuthSession.cs b/Server/AuthSession.cs index 443d3ae..d871bb0 100644 --- a/Server/AuthSession.cs +++ b/Server/AuthSession.cs @@ -31,7 +31,7 @@ public class AuthSession : TcpSession public void Send(IPacket packet) { var type = packet.GetType(); - this._logger.LogTrace("Packet of type {Type} is being serialized", type.Name); + this._logger.LogInformation("Packet of type {Type} is being serialized", type.Name); var packetIdAttribute = type.GetCustomAttribute(); if (packetIdAttribute == null) { @@ -59,8 +59,8 @@ public class AuthSession : TcpSession buffer[2 + i] = bytesOfOpcode[i]; } - this._logger.LogTrace("Packet data being parsed is: {Data}", BitConverter.ToString(packetData.ToArray())); - this._logger.LogTrace("Packet being parsed is: {Data}", BitConverter.ToString(buffer.ToArray())); + this._logger.LogInformation("Packet data being parsed is: {Data}", BitConverter.ToString(packetData.ToArray())); + this._logger.LogInformation("Packet being parsed is: {Data}", BitConverter.ToString(buffer.ToArray())); this.Send(buffer); } diff --git a/Server/PacketHandlers/CharacterCreationHandler..cs b/Server/PacketHandlers/CharacterCreationHandler..cs index 52bb1b3..b894f87 100644 --- a/Server/PacketHandlers/CharacterCreationHandler..cs +++ b/Server/PacketHandlers/CharacterCreationHandler..cs @@ -59,9 +59,9 @@ public class CharacterCreationHandler : IPacketHandler Health = 250, Mana = 250, }); - await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false); + await _wonderkingContext.SaveChangesAsync().ConfigureAwait(true); - var character = await _wonderkingContext.Characters.AsNoTracking() + var character = await _wonderkingContext.Characters.AsNoTrackingWithIdentityResolution() .Where(c => authSession != null && c.Account.Id == authSession.AccountId && c.Name == packet.Name) .Select(c => new CharacterData @@ -82,7 +82,7 @@ public class CharacterCreationHandler : IPacketHandler .Where(item => item.InventoryTab == InventoryTab.WornCashEquipment) .Select(item => item.ItemId) .ToArray(), - }).FirstOrDefaultAsync().ConfigureAwait(true); + }).FirstAsync().ConfigureAwait(true); authSession?.Send(new CharacterCreationResponsePacket { Character = character }); } }