Run cleanup tasks only on startup via manual calls

This commit is contained in:
Dean Herbert
2017-10-17 19:58:33 +09:00
parent b9d0fb96ed
commit e4a066dc5f
5 changed files with 8 additions and 18 deletions

View File

@ -104,6 +104,8 @@ namespace osu.Game.Beatmaps
if (importHost != null) if (importHost != null)
ipc = new BeatmapIPCChannel(importHost, this); ipc = new BeatmapIPCChannel(importHost, this);
beatmaps.Cleanup();
} }
/// <summary> /// <summary>

View File

@ -40,12 +40,6 @@ namespace osu.Game.Beatmaps
} }
} }
protected override void StartupTasks()
{
base.StartupTasks();
cleanupPendingDeletions();
}
/// <summary> /// <summary>
/// Add a <see cref="BeatmapSetInfo"/> to the database. /// Add a <see cref="BeatmapSetInfo"/> to the database.
/// </summary> /// </summary>
@ -136,7 +130,7 @@ namespace osu.Game.Beatmaps
return true; return true;
} }
private void cleanupPendingDeletions() public override void Cleanup()
{ {
var context = GetContext(); var context = GetContext();

View File

@ -27,14 +27,12 @@ namespace osu.Game.Database
Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database...");
Prepare(true); Prepare(true);
} }
StartupTasks();
} }
/// <summary> /// <summary>
/// Perform any common startup tasks. Runs after <see cref="Prepare(bool)"/>. /// Perform any common clean-up tasks. Should be run when idle, or whenever necessary.
/// </summary> /// </summary>
protected virtual void StartupTasks() public virtual void Cleanup()
{ {
} }

View File

@ -38,12 +38,6 @@ namespace osu.Game.IO
} }
} }
protected override void StartupTasks()
{
base.StartupTasks();
deletePending();
}
public FileInfo Add(Stream data, bool reference = true) public FileInfo Add(Stream data, bool reference = true)
{ {
var context = GetContext(); var context = GetContext();
@ -101,7 +95,7 @@ namespace osu.Game.IO
context.SaveChanges(); context.SaveChanges();
} }
private void deletePending() public override void Cleanup()
{ {
var context = GetContext(); var context = GetContext();

View File

@ -160,6 +160,8 @@ namespace osu.Game
}; };
API.Register(this); API.Register(this);
FileStore.Cleanup();
} }
private WorkingBeatmap lastBeatmap; private WorkingBeatmap lastBeatmap;