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

Revert async Task change

This commit is contained in:
Dan Balasescu 2022-09-09 16:12:18 +09:00
parent 08d0c08750
commit 280b1dd484

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -45,12 +46,12 @@ namespace osu.Game
{ {
base.LoadComplete(); base.LoadComplete();
Task.Run(async () => Task.Run(() =>
{ {
Logger.Log("Beginning background beatmap processing.."); Logger.Log("Beginning background beatmap processing..");
checkForOutdatedStarRatings(); checkForOutdatedStarRatings();
await processBeatmapSetsWithMissingMetrics(); processBeatmapSetsWithMissingMetrics();
await processScoresWithMissingStatistics(); processScoresWithMissingStatistics();
}).ContinueWith(t => }).ContinueWith(t =>
{ {
if (t.Exception?.InnerException is ObjectDisposedException) if (t.Exception?.InnerException is ObjectDisposedException)
@ -99,7 +100,7 @@ namespace osu.Game
} }
} }
private async Task processBeatmapSetsWithMissingMetrics() private void processBeatmapSetsWithMissingMetrics()
{ {
HashSet<Guid> beatmapSetIds = new HashSet<Guid>(); HashSet<Guid> beatmapSetIds = new HashSet<Guid>();
@ -123,7 +124,7 @@ namespace osu.Game
while (localUserPlayInfo?.IsPlaying.Value == true) while (localUserPlayInfo?.IsPlaying.Value == true)
{ {
Logger.Log("Background processing sleeping due to active gameplay..."); Logger.Log("Background processing sleeping due to active gameplay...");
await Task.Delay(TimeToSleepDuringGameplay); Thread.Sleep(TimeToSleepDuringGameplay);
} }
realmAccess.Run(r => realmAccess.Run(r =>
@ -146,7 +147,7 @@ namespace osu.Game
} }
} }
private async Task processScoresWithMissingStatistics() private void processScoresWithMissingStatistics()
{ {
HashSet<Guid> scoreIds = new HashSet<Guid>(); HashSet<Guid> scoreIds = new HashSet<Guid>();
@ -168,7 +169,7 @@ namespace osu.Game
while (localUserPlayInfo?.IsPlaying.Value == true) while (localUserPlayInfo?.IsPlaying.Value == true)
{ {
Logger.Log("Background processing sleeping due to active gameplay..."); Logger.Log("Background processing sleeping due to active gameplay...");
await Task.Delay(TimeToSleepDuringGameplay); Thread.Sleep(TimeToSleepDuringGameplay);
} }
try try