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

[BUG]: Delayed Load Times of OctoPrint if Plug Unreachable/Offline #309

Open
jneilliii opened this issue May 17, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@jneilliii
Copy link
Owner

Describe the bug
If a smartplug is registered with an IP and that IP is not online the OctoPrint UI takes a long time to load.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the plugin's settings and enter an invalid IP address.
  2. Save the settings.
  3. Refresh the page and notice that the file list doesn't propagate for a while.

Expected behavior
The web interface to act normally.

Screenshots
N/A

Additional context
I believe this may be related to socket timeout not being set and the default value being very long. Not sure if this delay is happening in socket.inet_aton(plugip) or socket.gethostbyname(plugip) or after.

Potential solution:

			sock_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			sock_tcp.settimeout(5)
			sock_tcp.connect((ip, 9999))
			sock_tcp.settimeout(None)
@jneilliii jneilliii added the bug Something isn't working label May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant