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

Improve reload performance #1451

Merged
merged 3 commits into from
Aug 17, 2024

Conversation

JonnyWong16
Copy link
Collaborator

Description

Some of the default PlexPartialObject include parameters are unnecessary. The additional data is requested from the Plex server but just gets discarded or unused. For example:

  • includeExtras=1 adds extras to the metadata, but extras are fetched on-demand using the ExtrasMixin.extras() method.
  • includeRelated=1 adds related media hubs to the metadata, but the related hubs are fetched on-demand using the HubsMixin.hubs() method.

This change disables all the unused include parameters where an alternative on-demand method exists. This improves reloading (and auto-reloading) performance significantly.

Because not all the include parameters are included by default, isFullObject() now checks if the key path matches the init path as well as if the key query string is a subset of the init query string. This allows adding extra reload parameters in addition to the default parameters also a full object.

Breaking Change

The checkFiles parameter default is changed to 0 (disabled). This prevents the Plex server from scanning the files to check if they exist and are accessible which can have a significant impact on API response time. This only affects the MediaPart.exists and MediaPart.accessible attributes. A manual reload using reload(checkFiles=True) is now required to access these two attributes.

Ref.: #1449

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

@JonnyWong16 JonnyWong16 merged commit bbe3e8e into pkkid:master Aug 17, 2024
5 checks passed
@JonnyWong16 JonnyWong16 deleted the bugfix/improve_performance branch August 18, 2024 18:25
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.

1 participant