Do not try to send signals to a client after 30 consecutive failures.
This commit is contained in:
parent
885ca2c899
commit
e554140276
|
@ -62,12 +62,18 @@ class SignalManager(component.Component):
|
|||
self.clients[uri] = xmlrpclib.ServerProxy(uri)
|
||||
|
||||
def emit(self, signal, *data):
|
||||
for client in self.clients.values():
|
||||
gobject.idle_add(self._emit, client, signal, *data)
|
||||
for uri in self.clients:
|
||||
gobject.idle_add(self._emit, uri, signal, 1, *data)
|
||||
|
||||
def _emit(self, client, signal, *data):
|
||||
def _emit(self, uri, signal, count, *data):
|
||||
client = self.clients[uri]
|
||||
try:
|
||||
client.emit_signal(signal, *data)
|
||||
except (socket.error, Exception), e:
|
||||
log.warning("Unable to emit signal to client %s: %s", client, e)
|
||||
log.warning("Unable to emit signal to client %s: %s (%d)", client, e, count)
|
||||
if count < 30:
|
||||
gobject.timeout_add(1000, self._emit, uri, signal, count + 1, *data)
|
||||
else:
|
||||
log.info("Removing %s because it couldn't be reached..", uri)
|
||||
del self.clients[uri]
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class SignalReceiver(
|
|||
log.warning("Unable to call callback for signal %s",
|
||||
signal)
|
||||
except KeyError:
|
||||
log.debug("There are no callbacks registered for this signal..")
|
||||
log.debug("There are no callbacks registered for signal '%s'", signal)
|
||||
|
||||
def connect_to_signal(self, signal, callback):
|
||||
"""Connect to a signal"""
|
||||
|
|
Loading…
Reference in New Issue