mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-17 15:22:26 +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
|
#if !DEBUG
|
||||||
return this.NotFound();
|
return this.NotFound();
|
||||||
#else
|
#else
|
||||||
RoomHelper.Rooms.RemoveAll();
|
lock(RoomHelper.RoomLock) RoomHelper.Rooms.RemoveAll();
|
||||||
return this.Redirect("/debug/roomVisualizer");
|
return this.Redirect("/debug/roomVisualizer");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dpadrate/@EntryIndexedValue">True</s:Boolean>
|
<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/=ezoiar/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=farc/@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/=friendscores/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ingame/@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>
|
<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 class RoomHelper
|
||||||
{
|
{
|
||||||
|
public static readonly object RoomLock = new();
|
||||||
public static StorableList<Room> Rooms => RoomStore.GetRooms();
|
public static StorableList<Room> Rooms => RoomStore.GetRooms();
|
||||||
|
|
||||||
public static void StartCleanupThread()
|
public static void StartCleanupThread()
|
||||||
|
@ -162,7 +163,7 @@ public class RoomHelper
|
||||||
};
|
};
|
||||||
|
|
||||||
CleanupRooms(room.HostId, room);
|
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);
|
Logger.Info($"Created room (id: {room.RoomId}) for host {room.HostId}", LogArea.Match);
|
||||||
|
|
||||||
return room;
|
return room;
|
||||||
|
@ -193,7 +194,7 @@ public class RoomHelper
|
||||||
[SuppressMessage("ReSharper", "InvertIf")]
|
[SuppressMessage("ReSharper", "InvertIf")]
|
||||||
public static void CleanupRooms(int? hostId = null, Room? newRoom = null, Database? database = null)
|
public static void CleanupRooms(int? hostId = null, Room? newRoom = null, Database? database = null)
|
||||||
{
|
{
|
||||||
lock(Rooms)
|
lock(RoomLock)
|
||||||
{
|
{
|
||||||
int roomCountBeforeCleanup = Rooms.Count();
|
int roomCountBeforeCleanup = Rooms.Count();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue