mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Revert "Fix inconsistent lock usage in BeatmapManager"
This reverts commit 4a064da30f
.
This commit is contained in:
parent
e3d31bdd10
commit
56e8c7303c
@ -138,9 +138,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
var set = queryBeatmapSets().First();
|
var set = queryBeatmapSets().First();
|
||||||
|
|
||||||
foreach (BeatmapInfo b in set.Beatmaps)
|
foreach (BeatmapInfo b in set.Beatmaps)
|
||||||
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
|
|
||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count > 0);
|
Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||||
|
|
||||||
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
|
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
|
||||||
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
|
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
|
||||||
|
@ -59,6 +59,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private readonly FileStore files;
|
private readonly FileStore files;
|
||||||
|
|
||||||
|
private readonly OsuDbContext connection;
|
||||||
|
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly BeatmapStore beatmaps;
|
private readonly BeatmapStore beatmaps;
|
||||||
@ -90,6 +92,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
|
this.connection = connection;
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
@ -160,7 +163,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="archiveReader">The beatmap to be imported.</param>
|
/// <param name="archiveReader">The beatmap to be imported.</param>
|
||||||
public BeatmapSetInfo Import(ArchiveReader archiveReader)
|
public BeatmapSetInfo Import(ArchiveReader archiveReader)
|
||||||
{
|
{
|
||||||
BeatmapSetInfo set;
|
BeatmapSetInfo set = null;
|
||||||
|
|
||||||
// let's only allow one concurrent import at a time for now.
|
// let's only allow one concurrent import at a time for now.
|
||||||
lock (importLock)
|
lock (importLock)
|
||||||
@ -178,8 +181,7 @@ namespace osu.Game.Beatmaps
|
|||||||
// If we have an ID then we already exist in the database.
|
// If we have an ID then we already exist in the database.
|
||||||
if (beatmapSetInfo.ID != 0) return;
|
if (beatmapSetInfo.ID != 0) return;
|
||||||
|
|
||||||
lock (beatmaps)
|
beatmaps.Add(beatmapSetInfo);
|
||||||
beatmaps.Add(beatmapSetInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -270,21 +272,13 @@ namespace osu.Game.Beatmaps
|
|||||||
/// Delete a beatmap difficulty.
|
/// Delete a beatmap difficulty.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The beatmap difficulty to hide.</param>
|
/// <param name="beatmap">The beatmap difficulty to hide.</param>
|
||||||
public void Hide(BeatmapInfo beatmap)
|
public void Hide(BeatmapInfo beatmap) => beatmaps.Hide(beatmap);
|
||||||
{
|
|
||||||
lock (beatmaps)
|
|
||||||
beatmaps.Hide(beatmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restore a beatmap difficulty.
|
/// Restore a beatmap difficulty.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The beatmap difficulty to restore.</param>
|
/// <param name="beatmap">The beatmap difficulty to restore.</param>
|
||||||
public void Restore(BeatmapInfo beatmap)
|
public void Restore(BeatmapInfo beatmap) => beatmaps.Restore(beatmap);
|
||||||
{
|
|
||||||
lock (beatmaps)
|
|
||||||
beatmaps.Restore(beatmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="BeatmapSetInfo"/> to a usable state if it has previously been deleted but not yet purged.
|
/// Returns a <see cref="BeatmapSetInfo"/> to a usable state if it has previously been deleted but not yet purged.
|
||||||
@ -293,8 +287,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="beatmapSet">The beatmap to restore.</param>
|
/// <param name="beatmapSet">The beatmap to restore.</param>
|
||||||
public void Undelete(BeatmapSetInfo beatmapSet)
|
public void Undelete(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
lock (beatmaps)
|
if (!beatmaps.Undelete(beatmapSet)) return;
|
||||||
if (!beatmaps.Undelete(beatmapSet)) return;
|
|
||||||
|
|
||||||
if (!beatmapSet.Protected)
|
if (!beatmapSet.Protected)
|
||||||
files.Reference(beatmapSet.Files.Select(f => f.FileInfo).ToArray());
|
files.Reference(beatmapSet.Files.Select(f => f.FileInfo).ToArray());
|
||||||
@ -368,8 +361,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>Results from the provided query.</returns>
|
/// <returns>Results from the provided query.</returns>
|
||||||
public List<BeatmapSetInfo> QueryBeatmapSets(Func<BeatmapSetInfo, bool> query)
|
public List<BeatmapSetInfo> QueryBeatmapSets(Func<BeatmapSetInfo, bool> query)
|
||||||
{
|
{
|
||||||
lock (beatmaps)
|
return beatmaps.QueryAndPopulate(query);
|
||||||
return beatmaps.QueryAndPopulate(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user