Remove Task from the inner-most Import method in RealmArchiveModelImporter

One of my pending work items for post-realm merge.

The lowest-level import task is no longer asynchronous, as we don't want
it to span multiple threads to allow easier interaction with realm.
Removing the `Task` spec simplifies a heap of usages.

Individual usages should decide whether they want to run the import
asynchronously, by either using an alternative override or spooling up a
thread themselves.
This commit is contained in:
Dean Herbert
2022-01-25 15:23:51 +09:00
parent ae0fea8e26
commit 778d2a71b4
21 changed files with 57 additions and 62 deletions

View File

@ -1024,11 +1024,11 @@ namespace osu.Game.Screens.Play
/// </summary>
/// <param name="score">The <see cref="Scoring.Score"/> to import.</param>
/// <returns>The imported score.</returns>
protected virtual async Task ImportScore(Score score)
protected virtual Task ImportScore(Score score)
{
// Replays are already populated and present in the game's database, so should not be re-imported.
if (DrawableRuleset.ReplayScore != null)
return;
return Task.CompletedTask;
LegacyByteArrayReader replayReader;
@ -1048,7 +1048,7 @@ namespace osu.Game.Screens.Play
// conflicts across various systems (ie. solo and multiplayer).
importableScore.OnlineID = -1;
var imported = await scoreManager.Import(importableScore, replayReader).ConfigureAwait(false);
var imported = scoreManager.Import(importableScore, replayReader);
imported.PerformRead(s =>
{
@ -1056,6 +1056,8 @@ namespace osu.Game.Screens.Play
score.ScoreInfo.Hash = s.Hash;
score.ScoreInfo.ID = s.ID;
});
return Task.CompletedTask;
}
/// <summary>