Skip to content
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

Allow overriding the includeRelated parameter for the item metadata endpoint #26

Closed
darthShadow opened this issue Aug 9, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@darthShadow
Copy link

Following the discussion from #24 (comment).

Sometimes, plex can have corrupt metadata for related items which results in the default item metadata API, with includeRelated=1, to take a long time or fail altogether. Since the plex clients call this metadata API before starting playback, any error here results in playback failing too. And if playback of the same item is attempted multiple times, it can cause the Plex CPU usage to shoot up and result in everything failing.

Forum References:

https://forums.plex.tv/t/view-xml-and-playback-of-certain-items-makes-plex-unresponsive-includerelated-1/830514
https://forums.plex.tv/t/plex-movie-issue-cpu-death-spiral/828916

Trying to override the parameter from Nginx or HAProxy has caused other issues, presumably because it results in the the Related section of the response being missing altogether rather than simply being empty.

@Quick104
Copy link

Quick104 commented Aug 9, 2023

I'm also seeing this issue and am happy to provide a test server if required. I can send an invite to my current server and run any tests needed or can deploy a duplicate container that you're free to work on.

@lostb1t lostb1t added the enhancement New feature or request label Aug 9, 2023
@lostb1t
Copy link
Owner

lostb1t commented Aug 11, 2023

Alright added an option REPLEX_DISABLE_RELATED.

I put an 5 second timeout on the media related call. (so that if related works it will still show up under a media item in the UI' and disabled includeRelated on /library/metadata/<id> and 'playQueues'

You can test it out with this image ghcr.io/sarendsen/replex:disablerelated (don't forget to set the option) You can test it out in the latest release

let me know

@darthShadow
Copy link
Author

darthShadow commented Aug 11, 2023

Would it be possible to add some intelligence to this?

Something like this:

  • Do an initial call with includeRelated=1 and timeout of 5 seconds (unless disabled altogether via REPLEX_DISABLE_RELATED)
  • If that fails, repeat the call with includeRelated=0
  • Add an empty Related key in the received response before returning it

@lostb1t
Copy link
Owner

lostb1t commented Aug 11, 2023

I could also add a timeout check to the include parameter yes. Would like to know if the current functionality works tho before committing more time

Fyi the initial functionality has been merged into main and released

@darthShadow
Copy link
Author

Will let @Quick104 test and report since this seems to happen more frequently for a few users and not for others (considering the relatively few users in the linked plex threads).

It happened to me too a few months ago but I haven't been able to reproduce the issue recently.

@darthShadow
Copy link
Author

May also be a good idea to post on the linked thread (https://forums.plex.tv/t/plex-movie-issue-cpu-death-spiral/828916) and let anyone facing the issue try it out too.

@Quick104
Copy link

Alright added an option REPLEX_DISABLE_RELATED.

I put an 5 second timeout on the media related call. (so that if related works it will still show up under a media item in the UI' and disabled includeRelated on /library/metadata/<id> and 'playQueues'

You can test it out with this image ghcr.io/sarendsen/replex:disablerelated (don't forget to set the option) You can test it out in the latest release

let me know

Awesome, that was fast! The current functionality works as expected. Playback and "View XML" both load instantly and the related content times out after 5 seconds for effected items.

@lostb1t
Copy link
Owner

lostb1t commented Aug 11, 2023

Allright then in gonna close this issue. It’s fine for the moment. If the need arises then a new issue can be created

@lostb1t lostb1t closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants