diff options
author | Matthew Hodgson <matthew@matrix.org> | 2014-12-07 23:44:16 +0000 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2014-12-07 23:44:16 +0000 |
commit | 5cd43d4b9f3c41b21ced0ab44cf24c2cf7dab817 (patch) | |
tree | 8060d1851dfa4abdf911870355c440cc727411e2 | |
parent | track replication destination health, and perform exponential back-off when s... (diff) | |
download | synapse-5cd43d4b9f3c41b21ced0ab44cf24c2cf7dab817.tar.xz |
fix stupid syntax thinkos
-rw-r--r-- | synapse/federation/replication.py | 23 | ||||
-rw-r--r-- | synapse/storage/transactions.py | 2 |
2 files changed, 12 insertions, 13 deletions
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index f9c05b5ea3..1b9e3ece09 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -866,7 +866,7 @@ class _TransactionQueue(object): if code == 200: deferred.callback(None) else: - start_retrying(destination, retry_interval) + self.start_retrying(destination, retry_interval) deferred.errback(RuntimeError("Got status %d" % code)) # Ensures we don't continue until all callbacks on that @@ -883,7 +883,7 @@ class _TransactionQueue(object): # for this finishing functions deferred. logger.exception("TX [%s] Problem in _attempt_transaction: %s", destination, e) - start_retrying(destination, retry_interval) + self.start_retrying(destination, retry_interval) for deferred in deferreds: if not deferred.called: @@ -896,13 +896,12 @@ class _TransactionQueue(object): # Check to see if there is anything else to send. self._attempt_new_transaction(destination) -def start_retrying(destination, retry_interval): - # track that this destination is having problems and we should - # give it a chance to recover before trying it again - if retry_interval: - retry_interval *= 2 - else: - retry_interval = 2 # try again at first after 2 seconds - self.store.set_destination_retry_timings(destination, - int(self._clock.time_msec()), retry_interval) - \ No newline at end of file + def start_retrying(self, destination, retry_interval): + # track that this destination is having problems and we should + # give it a chance to recover before trying it again + if retry_interval: + retry_interval *= 2 + else: + retry_interval = 2 # try again at first after 2 seconds + self.store.set_destination_retry_timings(destination, + int(self._clock.time_msec()), retry_interval) diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py index 47b73f7458..cacd948302 100644 --- a/synapse/storage/transactions.py +++ b/synapse/storage/transactions.py @@ -230,7 +230,7 @@ class TransactionStore(SQLBaseStore): else: return None - def set_destination_retry_timings(self, destination): + def set_destination_retry_timings(self, destination, retry_last_ts, retry_interval): """Sets the current retry timings for a given destination. Both timings should be zero if retrying is no longer occuring. |