Skip to content

Collection: show missing count when beatmaps are deleted (#32244) #32944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SkyheartOfficial
Copy link

Intended to closes #32244

This adds “(n missing)” when beatmaps in a collection are deleted.

All tests pass, style checks clean.

@SkyheartOfficial SkyheartOfficial changed the title Collection: show missing count when beatmaps are deleted (#32244 Collection: show missing count when beatmaps are deleted (#32244) Apr 24, 2025
? $"{count:#,0} item"
: $"{count:#,0} items";
// subscribe to all BeatmapInfo changes
subscription = realmAccess.RegisterForNotifications(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this, in total, is going to take out as many subscriptions as there are collections in this list? That's going to be a very difficult one to accept for me. People have a lot of collections.

{
List<string> beatmapHashes = collection.PerformRead(c => c.BeatmapMD5Hashes.ToList());
int total = beatmapHashes.Count;
int missing = beatmapHashes.Count(hash => beatmapManager.QueryBeatmap(b => b.MD5Hash == hash) == null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let me get this straight:

.Count() here is LINQ. Meaning that for every beatmap hash in a collection, this is going to perform one beatmap lookup by hash. This happens every time any beatmap in the game is added, modified or removed. And also this is going to simultaneously be queried for every single collection existing in the game when the N subscriptions for N collections fire.

I haven't ran this yet, but let's just say I'm skeptical this will be anywhere near acceptable performance. Benchmarking on a not-small database would be very appreciated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collection item count inaccurate after deleting beatmap
2 participants