mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-09-19 22:34:36 -04:00
Wake up transaction queue when remote server comes back online (#6706)
This will be used to retry outbound transactions to a remote server if we think it might have come back up.
This commit is contained in:
parent
5ce0b17e38
commit
a8a50f5b57
11 changed files with 135 additions and 8 deletions
|
@ -21,6 +21,7 @@ from prometheus_client import Counter
|
|||
|
||||
from twisted.internet import defer
|
||||
|
||||
import synapse
|
||||
import synapse.metrics
|
||||
from synapse.federation.sender.per_destination_queue import PerDestinationQueue
|
||||
from synapse.federation.sender.transaction_manager import TransactionManager
|
||||
|
@ -54,7 +55,7 @@ sent_pdus_destination_dist_total = Counter(
|
|||
|
||||
|
||||
class FederationSender(object):
|
||||
def __init__(self, hs):
|
||||
def __init__(self, hs: "synapse.server.HomeServer"):
|
||||
self.hs = hs
|
||||
self.server_name = hs.hostname
|
||||
|
||||
|
@ -482,7 +483,20 @@ class FederationSender(object):
|
|||
|
||||
def send_device_messages(self, destination):
|
||||
if destination == self.server_name:
|
||||
logger.info("Not sending device update to ourselves")
|
||||
logger.warning("Not sending device update to ourselves")
|
||||
return
|
||||
|
||||
self._get_per_destination_queue(destination).attempt_new_transaction()
|
||||
|
||||
def wake_destination(self, destination: str):
|
||||
"""Called when we want to retry sending transactions to a remote.
|
||||
|
||||
This is mainly useful if the remote server has been down and we think it
|
||||
might have come back.
|
||||
"""
|
||||
|
||||
if destination == self.server_name:
|
||||
logger.warning("Not waking up ourselves")
|
||||
return
|
||||
|
||||
self._get_per_destination_queue(destination).attempt_new_transaction()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue