1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 22:22:55 +08:00

Fix requests being indefinitely queued when user is offline

This commit is contained in:
Dean Herbert 2021-02-24 19:57:42 +09:00
parent 5dc0aefb2b
commit 9ed8d902f7

View File

@ -381,7 +381,13 @@ namespace osu.Game.Online.API
public void Queue(APIRequest request) public void Queue(APIRequest request)
{ {
lock (queue) queue.Enqueue(request); lock (queue)
{
if (state.Value == APIState.Offline)
return;
queue.Enqueue(request);
}
} }
private void flushQueue(bool failOldRequests = true) private void flushQueue(bool failOldRequests = true)
@ -402,8 +408,6 @@ namespace osu.Game.Online.API
public void Logout() public void Logout()
{ {
flushQueue();
password = null; password = null;
authentication.Clear(); authentication.Clear();
@ -415,6 +419,7 @@ namespace osu.Game.Online.API
}); });
state.Value = APIState.Offline; state.Value = APIState.Offline;
flushQueue();
} }
private static User createGuestUser() => new GuestUser(); private static User createGuestUser() => new GuestUser();