mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 13:42:54 +08:00
Fix online lookup cache not clearing completed task on early return
The task not being cleared in the early return path would cause `pendingRequestTask` to become stuck as a completed task, and `queryValue()` would not recreate it due to the null check there, therefore stalling all lookups forevermore until a game restart.
This commit is contained in:
parent
ee89d8643e
commit
ca7303a50a
@ -116,7 +116,10 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nextTaskBatch.Count == 0)
|
if (nextTaskBatch.Count == 0)
|
||||||
|
{
|
||||||
|
finishPendingTask();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Query the values.
|
// Query the values.
|
||||||
var request = CreateRequest(nextTaskBatch.Keys.ToArray());
|
var request = CreateRequest(nextTaskBatch.Keys.ToArray());
|
||||||
@ -125,13 +128,7 @@ namespace osu.Game.Database
|
|||||||
// todo: we probably want retry logic here.
|
// todo: we probably want retry logic here.
|
||||||
api.Perform(request);
|
api.Perform(request);
|
||||||
|
|
||||||
// Create a new request task if there's still more values to query.
|
finishPendingTask();
|
||||||
lock (taskAssignmentLock)
|
|
||||||
{
|
|
||||||
pendingRequestTask = null;
|
|
||||||
if (pendingTasks.Count > 0)
|
|
||||||
createNewTask();
|
|
||||||
}
|
|
||||||
|
|
||||||
var foundValues = RetrieveResults(request);
|
var foundValues = RetrieveResults(request);
|
||||||
|
|
||||||
@ -157,6 +154,17 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void finishPendingTask()
|
||||||
|
{
|
||||||
|
// Create a new request task if there's still more values to query.
|
||||||
|
lock (taskAssignmentLock)
|
||||||
|
{
|
||||||
|
pendingRequestTask = null;
|
||||||
|
if (pendingTasks.Count > 0)
|
||||||
|
createNewTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createNewTask() => pendingRequestTask = Task.Run(performLookup);
|
private void createNewTask() => pendingRequestTask = Task.Run(performLookup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user