Fix intermittent multiplayer tests

This commit is contained in:
smoogipoo
2021-10-15 00:10:39 +09:00
parent 79d9aa7383
commit e6ee360511
2 changed files with 26 additions and 14 deletions

View File

@ -359,22 +359,25 @@ namespace osu.Game.Online.Multiplayer
if (Room == null)
return;
await PopulateUser(user).ConfigureAwait(false);
Scheduler.Add(() =>
await Task.Run(async () =>
{
if (Room == null)
return;
await PopulateUser(user).ConfigureAwait(false);
// for sanity, ensure that there can be no duplicate users in the room user list.
if (Room.Users.Any(existing => existing.UserID == user.UserID))
return;
Scheduler.Add(() =>
{
if (Room == null)
return;
Room.Users.Add(user);
// for sanity, ensure that there can be no duplicate users in the room user list.
if (Room.Users.Any(existing => existing.UserID == user.UserID))
return;
UserJoined?.Invoke(user);
RoomUpdated?.Invoke();
}, false);
Room.Users.Add(user);
UserJoined?.Invoke(user);
RoomUpdated?.Invoke();
});
}).ConfigureAwait(false);
}
Task IMultiplayerClient.UserLeft(MultiplayerRoomUser user) =>