mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 01:55:53 +03:00
plateau retries after 1h
This commit is contained in:
parent
faf12b64f8
commit
71da2bed55
1 changed files with 6 additions and 3 deletions
|
@ -890,7 +890,7 @@ class _TransactionQueue(object):
|
|||
)
|
||||
deferred.callback(None)
|
||||
else:
|
||||
self.start_retrying(destination, retry_interval)
|
||||
self.set_retrying(destination, retry_interval)
|
||||
deferred.errback(RuntimeError("Got status %d" % code))
|
||||
|
||||
# Ensures we don't continue until all callbacks on that
|
||||
|
@ -908,7 +908,7 @@ class _TransactionQueue(object):
|
|||
logger.warn("TX [%s] Problem in _attempt_transaction: %s",
|
||||
destination, e)
|
||||
|
||||
self.start_retrying(destination, retry_interval)
|
||||
self.set_retrying(destination, retry_interval)
|
||||
|
||||
for deferred in deferreds:
|
||||
if not deferred.called:
|
||||
|
@ -922,11 +922,14 @@ class _TransactionQueue(object):
|
|||
self._attempt_new_transaction(destination)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def start_retrying(self, destination, retry_interval):
|
||||
def set_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
|
||||
# plateau at hourly retries for now
|
||||
if retry_interval >= 60 * 60 * 1000:
|
||||
retry_interval = 60 * 60 * 1000
|
||||
else:
|
||||
retry_interval = 2000 # try again at first after 2 seconds
|
||||
yield self.store.set_destination_retry_timings(destination,
|
||||
|
|
Loading…
Reference in a new issue