plateau retries after 1h

This commit is contained in:
Matthew Hodgson 2014-12-10 00:18:44 +00:00
parent faf12b64f8
commit 71da2bed55

View File

@ -890,7 +890,7 @@ class _TransactionQueue(object):
) )
deferred.callback(None) deferred.callback(None)
else: else:
self.start_retrying(destination, retry_interval) self.set_retrying(destination, retry_interval)
deferred.errback(RuntimeError("Got status %d" % code)) deferred.errback(RuntimeError("Got status %d" % code))
# Ensures we don't continue until all callbacks on that # 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", logger.warn("TX [%s] Problem in _attempt_transaction: %s",
destination, e) destination, e)
self.start_retrying(destination, retry_interval) self.set_retrying(destination, retry_interval)
for deferred in deferreds: for deferred in deferreds:
if not deferred.called: if not deferred.called:
@ -922,11 +922,14 @@ class _TransactionQueue(object):
self._attempt_new_transaction(destination) self._attempt_new_transaction(destination)
@defer.inlineCallbacks @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 # track that this destination is having problems and we should
# give it a chance to recover before trying it again # give it a chance to recover before trying it again
if retry_interval: if retry_interval:
retry_interval *= 2 retry_interval *= 2
# plateau at hourly retries for now
if retry_interval >= 60 * 60 * 1000:
retry_interval = 60 * 60 * 1000
else: else:
retry_interval = 2000 # try again at first after 2 seconds retry_interval = 2000 # try again at first after 2 seconds
yield self.store.set_destination_retry_timings(destination, yield self.store.set_destination_retry_timings(destination,