mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-08 20:54:57 -04:00
Ensure only main or federation_sender process can send federation traffic
This commit is contained in:
parent
b69f76c106
commit
26072df6af
3 changed files with 21 additions and 5 deletions
|
@ -274,14 +274,23 @@ class HomeServer(object):
|
|||
return TransportLayerClient(self)
|
||||
|
||||
def build_federation_sender(self):
|
||||
if self.config.send_federation:
|
||||
if self.should_send_federation():
|
||||
return TransactionQueue(self)
|
||||
else:
|
||||
elif not self.config.worker_app:
|
||||
return FederationRemoteSendQueue(self)
|
||||
else:
|
||||
raise Exception("Workers cannot send federation traffic")
|
||||
|
||||
def remove_pusher(self, app_id, push_key, user_id):
|
||||
return self.get_pusherpool().remove_pusher(app_id, push_key, user_id)
|
||||
|
||||
def should_send_federation(self):
|
||||
"Should this server be sending federation traffic directly?"
|
||||
return self.config.send_federation and (
|
||||
not self.config.worker_app
|
||||
or self.config.worker_app == "synapse.app.federation_sender"
|
||||
)
|
||||
|
||||
|
||||
def _make_dependency_method(depname):
|
||||
def _get(hs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue