|
@@ -9,9 +9,10 @@ PLEX_HOST = get_secret("plex.host")
|
|
|
@as_plugin
|
|
|
def plex():
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
+ s.settimeout(5)
|
|
|
try:
|
|
|
s.connect((PLEX_HOST, 32400))
|
|
|
s.shutdown(socket.SHUT_WR)
|
|
|
- return "Well, something is running on that port so, it's probably up!"
|
|
|
- except ConnectionRefusedError:
|
|
|
- return "I couldn't reach plex!"
|
|
|
+ except (ConnectionRefusedError, socket.timeout):
|
|
|
+ return "I couldn't reach plex within 5 seconds!"
|
|
|
+ return "Well, something is running on that port, so it's probably up!"
|