mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:12:56 +08:00
Fix download tracking components getting stuck on import failur… (#6639)
Fix download tracking components getting stuck on import failures
This commit is contained in:
commit
89d3f461e0
@ -108,7 +108,7 @@ namespace osu.Game.Database
|
||||
return Import(notification, paths);
|
||||
}
|
||||
|
||||
protected async Task Import(ProgressNotification notification, params string[] paths)
|
||||
protected async Task<IEnumerable<TModel>> Import(ProgressNotification notification, params string[] paths)
|
||||
{
|
||||
notification.Progress = 0;
|
||||
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import is initialising...";
|
||||
@ -168,6 +168,8 @@ namespace osu.Game.Database
|
||||
|
||||
notification.State = ProgressNotificationState.Completed;
|
||||
}
|
||||
|
||||
return imported;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -76,7 +76,12 @@ namespace osu.Game.Database
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
// This gets scheduled back to the update thread, but we want the import to run in the background.
|
||||
await Import(notification, filename);
|
||||
var imported = await Import(notification, filename);
|
||||
|
||||
// for now a failed import will be marked as a failed download for simplicity.
|
||||
if (!imported.Any())
|
||||
DownloadFailed?.Invoke(request);
|
||||
|
||||
currentDownloads.Remove(request);
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user