listener: Try and protect actors against "bad" events
This commit is contained in:
parent
a086857dd7
commit
aa010e03e9
@ -31,7 +31,8 @@ class CoreListener(listener.Listener):
|
||||
:type event: string
|
||||
:param kwargs: any other arguments to the specific event handlers
|
||||
"""
|
||||
getattr(self, event)(**kwargs)
|
||||
# Just delegate to parent, entry mostly for docs.
|
||||
super(CoreListener, self).on_event(event, **kwargs)
|
||||
|
||||
def track_playback_paused(self, tl_track, time_position):
|
||||
"""
|
||||
|
||||
@ -41,4 +41,8 @@ class Listener(object):
|
||||
:type event: string
|
||||
:param kwargs: any other arguments to the specific event handlers
|
||||
"""
|
||||
getattr(self, event)(**kwargs)
|
||||
try:
|
||||
getattr(self, event)(**kwargs)
|
||||
except Exception:
|
||||
# Ensure we don't crash the actor due to "bad" events.
|
||||
logger.exception('Triggering event failed: %s', event)
|
||||
|
||||
@ -47,6 +47,7 @@ class MpdDispatcher(object):
|
||||
return self._call_next_filter(request, response, filter_chain)
|
||||
|
||||
def handle_idle(self, subsystem):
|
||||
# TODO: validate against mopidy/mpd/protocol/status.SUBSYSTEMS
|
||||
self.context.events.add(subsystem)
|
||||
|
||||
subsystems = self.context.subscriptions.intersection(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user