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

Respect timeout from server #1225

Closed
glensc opened this issue Aug 23, 2023 · 3 comments · Fixed by #1231
Closed

Respect timeout from server #1225

glensc opened this issue Aug 23, 2023 · 3 comments · Fixed by #1231

Comments

@glensc
Copy link
Contributor

glensc commented Aug 23, 2023

What is your feature request?

Add support for _server.timeout being used instead (or addition to) global TIMEOUT


PlexAPI may call reload() on property access, and that call is routed to server.query() which can only read the global TIMEOUT (because called with out timeout=xxx parameter):

     def _reload():
        data = self._server.query(key)

Seems the problem is that each query method takes own timeout parameter, or uses global:

and the global comes from config:

Reported in:

Are there any workarounds?

Overwite the global TIMEOUT in __init__.py. Ugly but likely will work.

Code Snippets

No response

Additional Context

No response

@JonnyWong16
Copy link
Collaborator

Probably easiest to change the __init__ to self.timeout = timeout or TIMEOUT, then query to timeout = timeout or self._timeout.

PR welcome.

@glensc
Copy link
Contributor Author

glensc commented Aug 28, 2023

__init__ to self.timeout = timeout or TIMEOUT

that's not an issue. issue is in query. but probably makes sense for consistency.

but any ideas why overwriting TIMEOUT had no effect?

@JonnyWong16
Copy link
Collaborator

Because plexapi is importing TIMEOUT as a symbol in the local module.

from plexapi import BASE_HEADERS, CONFIG, TIMEOUT, log, logfilter

https://stackoverflow.com/a/3536638

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

Successfully merging a pull request may close this issue.

2 participants