mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-01 09:48:37 +00:00
Lock rooms when cleaning up
This commit is contained in:
parent
92d8512090
commit
b6081ec65f
1 changed files with 6 additions and 2 deletions
|
@ -193,7 +193,9 @@ public class RoomHelper
|
|||
[SuppressMessage("ReSharper", "InvertIf")]
|
||||
public static void CleanupRooms(int? hostId = null, Room? newRoom = null, Database? database = null)
|
||||
{
|
||||
int roomCountBeforeCleanup = Rooms.Count();
|
||||
lock(Rooms)
|
||||
{
|
||||
int roomCountBeforeCleanup = Rooms.Count();
|
||||
|
||||
// Remove offline players from rooms
|
||||
foreach (Room room in Rooms)
|
||||
|
@ -232,7 +234,9 @@ public class RoomHelper
|
|||
|
||||
if (roomCountBeforeCleanup != roomCountAfterCleanup)
|
||||
{
|
||||
Logger.LogDebug($"Cleaned up {roomCountBeforeCleanup - roomCountAfterCleanup} rooms.", LogArea.Match);
|
||||
Logger.LogDebug($"Cleaned up {roomCountBeforeCleanup - roomCountAfterCleanup} rooms.",
|
||||
LogArea.Match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue