mpd connection errors are properly logged
This commit is contained in:
parent
fd32e6b438
commit
84adc16cec
1 changed files with 10 additions and 5 deletions
|
@ -41,12 +41,11 @@ class MpcWatcher(ParentedLet):
|
||||||
status = self.client.idle()[0]
|
status = self.client.idle()[0]
|
||||||
except (ConnectionError, ConnectionRefusedError,
|
except (ConnectionError, ConnectionRefusedError,
|
||||||
FileNotFoundError) as exc:
|
FileNotFoundError) as exc:
|
||||||
# TODO: should we emit an error just in case?
|
self.log.warning('Connection to MPD failed ({}: {})'.
|
||||||
self.log.debug('connection with MPD failed ({}: {})'.
|
format(exc.__class__.__name__, exc))
|
||||||
format(exc.__class__.__name__, exc))
|
|
||||||
self.client = None
|
self.client = None
|
||||||
first_after_connection = True
|
first_after_connection = True
|
||||||
gevent.sleep(1)
|
gevent.sleep(5)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
first_after_connection = False
|
first_after_connection = False
|
||||||
|
@ -64,7 +63,13 @@ class Player:
|
||||||
|
|
||||||
def _get_mpd(self):
|
def _get_mpd(self):
|
||||||
mpd_client = MPDClient(use_unicode=True)
|
mpd_client = MPDClient(use_unicode=True)
|
||||||
mpd_client.connect(self.conf['MPD_HOST'], self.conf['MPD_PORT'])
|
try:
|
||||||
|
mpd_client.connect(self.conf['MPD_HOST'], self.conf['MPD_PORT'])
|
||||||
|
except (ConnectionError, ConnectionRefusedError,
|
||||||
|
FileNotFoundError) as exc:
|
||||||
|
self.log.warning('Connection to MPD failed ({}: {})'.
|
||||||
|
format(exc.__class__.__name__, exc))
|
||||||
|
raise gevent.GreenletExit()
|
||||||
return mpd_client
|
return mpd_client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue