Open jesus2099 opened 9 years ago
This ticket would also fix dynamic updater on 10+ medium releases (#133).
This would also fix (bottom work credits) Highlighting of indirectly related works #612
Work in progress blocked by MBS-11905:
https://github.com/jesus2099/konami-command/commits/ws-dynamic-updater_issue-64 Just one commit at the moment https://github.com/jesus2099/konami-command/commit/1f992228f82739ef33226c33d084f1dde2139614
Nicolás Tamargo Added 2021-08-23 19:20
The limit is 500 recordings, IIRC, and I don't think there's currently a way around it.
# On release browse endpoints in the webservice, we limit the number of
# releases returned such that the total number of tracks doesn't exceed this
# number.
sub WS_TRACK_LIMIT { 500 }
=head1 SYNOPSIS
[…]
Releases with more than 500 recordings ignore 'recording-level-rels', and
since those recordings aren't dumped separately, their relationships will
only be included in the target entities' output. As of 2017-04, this affects
~200 releases.
[…]
=cut
# The maximum number of recordings to try to get relationships for, if
# inc=recording-level-rels is specified. Certain releases with an enourmous
# number of recordings (audiobooks) will almost always timeout, driving up
# server load average for nothing. Ideally we can remove this limit as soon as
# we resolve the performance issues we have.
my $max_recording_relationships = 500;
https://github.com/metabrainz/musicbrainz-server/commit/cff992802e1e28e5511e3a2b05fb10974a4bf85b
Limit WS release lists to 500 tracks
This limits the results of release browse queries, including those from the discid endpoint, to contain no more than 500 tracks (however, it always returns at least one release, which may have more than 500 tracks on it).
With this change, certain browse queries with inc=recordings+artist-credits specified can actually have a chance to complete and not time out (which is more helpful to the client, since they'll actually get information back, and more helpful to the server, since it won't increase server load and hog worker processes for no end purpose).
=head2 limit_releases_by_tracks
Truncates a list of releases such that the entire list doesn't contain more
than C<DBDefs::WS_TRACK_LIMIT> tracks in total (but returns at least one
release). The idea is to limit browse queries that contain an excessive number
of tracks when C<inc=recordings> is specified.
Note: This mutates the passed-in array reference C<$releases>.
=cut
sub limit_releases_by_tracks {
my ($self, $c, $releases) = @_;
my $track_count = 0;
my $release_count = 0;
for my $release (@{$releases}) {
$c->model('Medium')->load_for_releases($release);
$track_count += (sum map { $_->track_count } $release->all_mediums) // 0;
last if $track_count > DBDefs->WS_TRACK_LIMIT && $release_count > 0;
$release_count++;
}
@$releases = @$releases[0 .. ($release_count - 1)];
}
One good thing is that there is a way to detect that I am on a release that has skipped recording-level-rels
, and not on a release that simply has no recording level relationships:
relations
in release.media[m].tracks[t].recording.relations
relations
does not exist in recording
when the 500+ track release limitation skips the recording-level-rels
: https://musicbrainz.org/ws/2/release/64e12f22-9377-49d3-99a9-155f7f6c4eae?inc=release-groups+recordings+artists+artist-credits+labels+recording-level-rels+work-rels&fmt=jsonrelations
is just an empty array ("relations": []
) when no relationships: https://musicbrainz.org/ws/2/release/1ff37b39-8b5e-4f35-b904-8720652f671c?inc=release-groups+recordings+artists+artist-credits+labels+recording-level-rels+work-rels&fmt=jsonIn fact it is very good and logical.
When it decides to not send relationships, I think it returns same thing it would return when not asked for recording-level-rels
.
Oh no, I lost my work in progress file, because of my recent official version (785427386d632fc3b68a940f4a327e9f025a90ea) that triggered auto-update. I should have saved my work in progress in git. 🤦
So MBS-11905 is not really blocking this.
I know recording.relations
is absent (instead of empty array) when I got no recording-level-rels
because of big release.
Browsing web service JSON responses is also a lot of fine-tuning! so I will try my utmost to reuse the existing functions from initial loading #174, rather than keeping a specific dynamic loader loading.
Dynamic remove not being converted to new mode, included release groups are not removed with dynamic remove (OFF or remove from collection).