mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-16 06:32:28 +00:00
Lock RoomHelper.Rooms properly
This commit is contained in:
parent
02abb7bcab
commit
615b57122e
3 changed files with 5 additions and 3 deletions
|
@ -42,7 +42,7 @@ public class RoomVisualizerController : ControllerBase
|
|||
#if !DEBUG
|
||||
return this.NotFound();
|
||||
#else
|
||||
RoomHelper.Rooms.RemoveAll();
|
||||
lock(RoomHelper.RoomLock) RoomHelper.Rooms.RemoveAll();
|
||||
return this.Redirect("/debug/roomVisualizer");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dpadrate/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ezoiar/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=farc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLUSHALL/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=friendscores/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ingame/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kettu/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace LBPUnion.ProjectLighthouse.Match.Rooms;
|
|||
|
||||
public class RoomHelper
|
||||
{
|
||||
public static readonly object RoomLock = new();
|
||||
public static StorableList<Room> Rooms => RoomStore.GetRooms();
|
||||
|
||||
public static void StartCleanupThread()
|
||||
|
@ -162,7 +163,7 @@ public class RoomHelper
|
|||
};
|
||||
|
||||
CleanupRooms(room.HostId, room);
|
||||
lock(Rooms) Rooms.Add(room);
|
||||
lock(RoomLock) Rooms.Add(room);
|
||||
Logger.Info($"Created room (id: {room.RoomId}) for host {room.HostId}", LogArea.Match);
|
||||
|
||||
return room;
|
||||
|
@ -193,7 +194,7 @@ public class RoomHelper
|
|||
[SuppressMessage("ReSharper", "InvertIf")]
|
||||
public static void CleanupRooms(int? hostId = null, Room? newRoom = null, Database? database = null)
|
||||
{
|
||||
lock(Rooms)
|
||||
lock(RoomLock)
|
||||
{
|
||||
int roomCountBeforeCleanup = Rooms.Count();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue