Speed up startup cleanup operations.

This commit is contained in:
Dean Herbert
2017-08-01 17:58:21 +09:00
parent 3b1166d1e6
commit 6eb960010f
2 changed files with 15 additions and 25 deletions

View File

@ -140,18 +140,21 @@ namespace osu.Game.IO
private void deletePending()
{
foreach (var f in QueryAndPopulate<FileInfo>(f => f.ReferenceCount < 1))
Connection.RunInTransaction(() =>
{
try
foreach (var f in Query<FileInfo>(f => f.ReferenceCount < 1))
{
Connection.Delete(f);
Storage.Delete(Path.Combine(prefix, f.StoragePath));
try
{
Storage.Delete(Path.Combine(prefix, f.StoragePath));
Connection.Delete(f);
}
catch (Exception e)
{
Logger.Error(e, $@"Could not delete beatmap {f}");
}
}
catch (Exception e)
{
Logger.Error(e, $@"Could not delete beatmap {f}");
}
}
});
}
}
}