Only lock database for the duration of a model restoration

This commit is contained in:
smoogipoo 2019-10-03 11:23:21 +09:00
parent c85d7c8b3f
commit f8eb07b211

View File

@ -436,20 +436,17 @@ namespace osu.Game.Database
int i = 0; int i = 0;
using (ContextFactory.GetForWrite()) foreach (var item in items)
{ {
foreach (var item in items) if (notification.State == ProgressNotificationState.Cancelled)
{ // user requested abort
if (notification.State == ProgressNotificationState.Cancelled) return;
// user requested abort
return;
notification.Text = $"Restoring ({++i} of {items.Count})"; notification.Text = $"Restoring ({++i} of {items.Count})";
Undelete(item); Undelete(item);
notification.Progress = (float)i / items.Count; notification.Progress = (float)i / items.Count;
}
} }
notification.State = ProgressNotificationState.Completed; notification.State = ProgressNotificationState.Completed;