1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-16 05:37:19 +08:00

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

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

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

@ -27,14 +27,12 @@ namespace osu.Game.Database
Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database...");
Prepare(true);
}
StartupTasks();
}
/// <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>
protected virtual void StartupTasks()
public virtual void Cleanup()
{
}

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

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