1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-14 05:47:20 +08:00

Merge pull request #28818 from peppy/configure-a-wait-what-the-foo-bar

Fix incorrect continuation in `ImportAsUpdate` causing UI blockage
This commit is contained in:
Dean Herbert 2024-07-11 15:54:42 +09:00 committed by GitHub
commit b1dd2ead30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -168,12 +168,12 @@ namespace osu.Game.Tests.Database
Assert.That(importAfterUpdate, Is.Not.Null);
Debug.Assert(importAfterUpdate != null);
realm.Run(r => r.Refresh());
// should only contain the modified beatmap (others purged).
Assert.That(importBeforeUpdate.Value.Beatmaps, Has.Count.EqualTo(1));
Assert.That(importAfterUpdate.Value.Beatmaps, Has.Count.EqualTo(count_beatmaps));
realm.Run(r => r.Refresh());
checkCount<BeatmapInfo>(realm, count_beatmaps + 1);
checkCount<BeatmapMetadata>(realm, count_beatmaps + 1);

View File

@ -43,7 +43,9 @@ namespace osu.Game.Beatmaps
public override async Task<Live<BeatmapSetInfo>?> ImportAsUpdate(ProgressNotification notification, ImportTask importTask, BeatmapSetInfo original)
{
var imported = await Import(notification, new[] { importTask }).ConfigureAwait(true);
Guid originalId = original.ID;
var imported = await Import(notification, new[] { importTask }).ConfigureAwait(false);
if (!imported.Any())
return null;
@ -53,7 +55,7 @@ namespace osu.Game.Beatmaps
var first = imported.First();
// If there were no changes, ensure we don't accidentally nuke ourselves.
if (first.ID == original.ID)
if (first.ID == originalId)
{
first.PerformRead(s =>
{
@ -69,7 +71,8 @@ namespace osu.Game.Beatmaps
Logger.Log($"Beatmap \"{updated}\" update completed successfully", LoggingTarget.Database);
original = realm!.Find<BeatmapSetInfo>(original.ID)!;
// Re-fetch as we are likely on a different thread.
original = realm!.Find<BeatmapSetInfo>(originalId)!;
// Generally the import process will do this for us if the OnlineIDs match,
// but that isn't a guarantee (ie. if the .osu file doesn't have OnlineIDs populated).