add errbacks to enqueue_pdu deferreds; change logging for failed federation sends to warn rather than exception

This commit is contained in:
Matthew Hodgson 2014-12-10 00:12:51 +00:00
parent 2b1acb7671
commit faf12b64f8
2 changed files with 12 additions and 8 deletions

View File

@ -334,7 +334,7 @@ class ReplicationLayer(object):
defer.returnValue(response) defer.returnValue(response)
return return
logger.debug("[%s] Transacition is new", transaction.transaction_id) logger.debug("[%s] Transaction is new", transaction.transaction_id)
with PreserveLoggingContext(): with PreserveLoggingContext():
dl = [] dl = []
@ -724,15 +724,19 @@ class _TransactionQueue(object):
deferreds = [] deferreds = []
for destination in destinations: for destination in destinations:
# XXX: why don't we specify an errback for this deferred
# like we do for EDUs? --matthew
deferred = defer.Deferred() deferred = defer.Deferred()
self.pending_pdus_by_dest.setdefault(destination, []).append( self.pending_pdus_by_dest.setdefault(destination, []).append(
(pdu, deferred, order) (pdu, deferred, order)
) )
def eb(failure):
if not deferred.called:
deferred.errback(failure)
else:
logger.warn("Failed to send pdu", failure)
with PreserveLoggingContext(): with PreserveLoggingContext():
self._attempt_new_transaction(destination) self._attempt_new_transaction(destination).addErrback(eb)
deferreds.append(deferred) deferreds.append(deferred)
@ -754,7 +758,7 @@ class _TransactionQueue(object):
if not deferred.called: if not deferred.called:
deferred.errback(failure) deferred.errback(failure)
else: else:
logger.exception("Failed to send edu", failure) logger.warn("Failed to send edu", failure)
with PreserveLoggingContext(): with PreserveLoggingContext():
self._attempt_new_transaction(destination).addErrback(eb) self._attempt_new_transaction(destination).addErrback(eb)
@ -901,7 +905,7 @@ class _TransactionQueue(object):
except Exception as e: except Exception as e:
# We capture this here as there as nothing actually listens # We capture this here as there as nothing actually listens
# for this finishing functions deferred. # for this finishing functions deferred.
logger.exception("TX [%s] Problem in _attempt_transaction: %s", logger.warn("TX [%s] Problem in _attempt_transaction: %s",
destination, e) destination, e)
self.start_retrying(destination, retry_interval) self.start_retrying(destination, retry_interval)

View File

@ -134,7 +134,7 @@ class MatrixFederationHttpClient(object):
e) e)
raise SynapseError(400, "Domain specified not found.") raise SynapseError(400, "Domain specified not found.")
logger.exception("Sending request failed to %s: %s %s : %s", logger.warn("Sending request failed to %s: %s %s : %s",
destination, method, url_bytes, e) destination, method, url_bytes, e)
_print_ex(e) _print_ex(e)
@ -289,7 +289,7 @@ def _print_ex(e):
for ex in e.reasons: for ex in e.reasons:
_print_ex(ex) _print_ex(ex)
else: else:
logger.exception(e) logger.warn(e)
class _JsonProducer(object): class _JsonProducer(object):