1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Remove unnecessary extra task

Further testing shows continuations also run before the .Wait() returns.
This commit is contained in:
smoogipoo 2021-10-15 13:27:54 +09:00
parent eed8fa8d69
commit 80dfd11c90

View File

@ -359,25 +359,22 @@ namespace osu.Game.Online.Multiplayer
if (Room == null)
return;
await Task.Run(async () =>
await PopulateUser(user).ConfigureAwait(false);
Scheduler.Add(() =>
{
await PopulateUser(user).ConfigureAwait(false);
if (Room == null)
return;
Scheduler.Add(() =>
{
if (Room == null)
return;
// 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;
// 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;
Room.Users.Add(user);
Room.Users.Add(user);
UserJoined?.Invoke(user);
RoomUpdated?.Invoke();
});
}).ConfigureAwait(false);
UserJoined?.Invoke(user);
RoomUpdated?.Invoke();
});
}
Task IMultiplayerClient.UserLeft(MultiplayerRoomUser user) =>