fix(hs): roll back team reservation if TryEnterAsync throws

This commit is contained in:
Acentech Dev
2026-07-20 23:48:36 +03:00
parent cd55e726f1
commit 372929a8d1

View File

@@ -160,19 +160,26 @@ public class HeykelSavasiContext : MiniGameContext
return false; return false;
} }
var success = false;
try
{
var enterResult = await this.TryEnterAsync(player).ConfigureAwait(false); var enterResult = await this.TryEnterAsync(player).ConfigureAwait(false);
if (enterResult != EnterResult.Success) success = enterResult == EnterResult.Success;
}
finally
{
if (!success)
{ {
lock (this._teamLock) lock (this._teamLock)
{ {
// Roll back the reservation; the player never actually entered the mini game. // Roll back the reservation; the player never actually entered the mini game
// (or TryEnterAsync threw, e.g. due to a disconnect/disposal race).
this.RemoveTeam(player); this.RemoveTeam(player);
} }
}
return false;
} }
return true; return success;
} }
/// <summary> /// <summary>