mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 08:16:02 -04:00
Ignore backoff history for invites, aliases, and roomdirs
Add a param to the federation client which lets us ignore historical backoff data for federation queries, and set it for a handful of operations.
This commit is contained in:
parent
4bd597d9fc
commit
5a16cb4bf0
6 changed files with 52 additions and 14 deletions
|
@ -35,7 +35,8 @@ class NotRetryingDestination(Exception):
|
|||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_retry_limiter(destination, clock, store, **kwargs):
|
||||
def get_retry_limiter(destination, clock, store, ignore_backoff=False,
|
||||
**kwargs):
|
||||
"""For a given destination check if we have previously failed to
|
||||
send a request there and are waiting before retrying the destination.
|
||||
If we are not ready to retry the destination, this will raise a
|
||||
|
@ -43,6 +44,14 @@ def get_retry_limiter(destination, clock, store, **kwargs):
|
|||
that will mark the destination as down if an exception is thrown (excluding
|
||||
CodeMessageException with code < 500)
|
||||
|
||||
Args:
|
||||
destination (str): name of homeserver
|
||||
clock (synapse.util.clock): timing source
|
||||
store (synapse.storage.transactions.TransactionStore): datastore
|
||||
ignore_backoff (bool): true to ignore the historical backoff data and
|
||||
try the request anyway. We will still update the next
|
||||
retry_interval on success/failure.
|
||||
|
||||
Example usage:
|
||||
|
||||
try:
|
||||
|
@ -66,7 +75,7 @@ def get_retry_limiter(destination, clock, store, **kwargs):
|
|||
|
||||
now = int(clock.time_msec())
|
||||
|
||||
if retry_last_ts + retry_interval > now:
|
||||
if not ignore_backoff and retry_last_ts + retry_interval > now:
|
||||
raise NotRetryingDestination(
|
||||
retry_last_ts=retry_last_ts,
|
||||
retry_interval=retry_interval,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue