mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 08:02:54 +08:00
Remove uncessary async-await state machine level.
This commit is contained in:
parent
ba818e3ae0
commit
a96c067bea
@ -24,14 +24,14 @@ namespace osu.Game.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The score to do the calculation on. </param>
|
/// <param name="score">The score to do the calculation on. </param>
|
||||||
/// <param name="token">An optional <see cref="CancellationToken"/> to cancel the operation.</param>
|
/// <param name="token">An optional <see cref="CancellationToken"/> to cancel the operation.</param>
|
||||||
public async Task<double?> CalculatePerformanceAsync([NotNull] ScoreInfo score, CancellationToken token = default)
|
public Task<double?> CalculatePerformanceAsync([NotNull] ScoreInfo score, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var lookupKey = new PerformanceCacheLookup(score);
|
var lookupKey = new PerformanceCacheLookup(score);
|
||||||
|
|
||||||
if (performanceCache.TryGetValue(lookupKey, out double performance))
|
if (performanceCache.TryGetValue(lookupKey, out double performance))
|
||||||
return performance;
|
return Task.FromResult((double?)performance);
|
||||||
|
|
||||||
return await computePerformanceAsync(score, lookupKey, token);
|
return computePerformanceAsync(score, lookupKey, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<double?> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
|
private async Task<double?> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
|
||||||
|
Loading…
Reference in New Issue
Block a user