-
Notifications
You must be signed in to change notification settings - Fork 112
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
Refactor: Add plex cache policy patterns #1279
Conversation
An easy way to find the
|
calling <!-- request: GET https://*.plex.direct:32400/library, response: 200 (460 bytes), created: 2022-12-11 23:27:11 EET, expires: N/A (fresh) -->
<?xml version='1.0' encoding='utf8'?>
<MediaContainer size="3" allowSync="0" art="/:/resources/library-art.png" content="" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1667296919" title1="Plex Library" title2="">
<Directory key="sections" title="Library Sections" />
<Directory key="recentlyAdded" title="Recently Added Content" />
<Directory key="onDeck" title="On Deck Content" />
</MediaContainer> this doesn't seem to contain anything useful, so I could be cached forever. but I'm wondering what is It seems to match timestamp |
there's a problem, can't set rule for root URL (used for "version" and "updated_at" calls), as it will match everything # version, updated_at
"*/": DO_NOT_CACHE, from docs:
|
c29b06c
to
d130b6c
Compare
could use |
d130b6c
to
c114a2b
Compare
Aren't login urls needed too ?
|
with trakt pull request, I went every method and looked what requests they make and converted there's slight possibility if some method under |
# fetch_item | ||
"*/library/sections/*/all?*": DO_NOT_CACHE, | ||
"*/library/sections/*/collections": DO_NOT_CACHE, | ||
"*/library/metadata/*": DO_NOT_CACHE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think metadata.provider.plex.tv/library/metadata/*
should be cached because there is no user data in response.
But metadata.provider.plex.tv/library/metadata/*/userState
must remain not cached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added dc07f64, but perhaps should have still some cache expiry rather NEVER_EXPIRE
? how much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we could have a random value, that'd be perfect.
It would allow to spread out the requests.
E.g. 3 month +random(0-30days)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's smart, but it's a value for the whole session.
At first run, all requests will have same expiration date. There is no spread out.
If impossible, i'd say NEVER_EXPIRE
is good enough for metadata.provider.plex.tv/library/metadata/*
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no metadata.provider.plex.tv/library/metadata/*/userState
, but rather https://metadata.provider.plex.tv/library/metadata/*?*includeUserState=1
and it includes view counts etc.
but I don't think we use those values, only test for guids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR to turn off userState:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other places were also uncacheable because session wasn't inherited:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randomize expire request:
41e2fe9
to
29e507a
Compare
Basically, all methods were manually verified and moved but could be that I didn't test all agent URLs, I'm still using Legacy Agent for shows due performance reasons.
|
a47279c
to
c5f0580
Compare
PUT methods are not cached anyway
* Add plex cache policy patterns * Add plex rule for fetch_item * Add cache rule for item history * Use DO_NOT_CACHE constant * Add rule for version, updated_at * Add cache rule for library_sections call * Disable root url rule for now; * Add rule for system_device methpd * Add rule for system_account method * Reorder to account for first match * Add rule for ratings search * Add patterns for plex playlists * Add rules for metadata.provider.plex.tv/library/metadata patterns * Add pattern for find_by_title * Record fetch_items pattern * Record rule for find_by_id * Add LONG_EXPIRY for metadata.provider.plex.tv/library/metadata/* * Add rule for /has_sessions * Add rule for plex.tv/users/account * Add rule for metadata.provider.plex.tv/library/sections/watchlist/all * Update includeUserState pattern * Add rule for len(PlexLibrarySection) * Add pattern for reloads * Add rule for PlexLibrarySection iteration * Add rule for episodes fetch * Add rules for mark played, mark unplayed * Sort items
* Remove nocache for playlists * Remove nocache for has_sessions * Remove nocache for _plex_account * Remove nocache from watchlist * Remove nocache for mark played, mark unplayed * Remove nocache for reset_show
* Remove nocache for get uids * Remove nocache for episodes * Remove nocache for rating method
c5f0580
to
6ebd0b7
Compare
Heavily tested I assume 👼 |
It's not git tagged yet. but fingers crossed! it already solved one issue for me that |
Come on.... |
what do you mean? I've been testing it and running it for a while. and I haven't made tag, that's what I said, it's not tagged yet. |
I thought you didn't test and only cross finger as a quality process. |
I wrote how I tested: you didn't reply anything to it. so I assumed you were fine with this. and plexapi fixes got released too. |
Continue #1221, but for plex urls.
Docs: