From 9b509a5ac6c6c7186ba54a321c3afba586281666 Mon Sep 17 00:00:00 2001
From: reivilibre See also MSC3902. The key idea is described by MSC706. This allows servers to
+ The key idea is described by MSC3706. This allows servers to
request a lightweight response to the federation
from
(required) - The token to start returning events from. This token can be obtained from a prev_batch
or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.to
- The token to spot returning events at.to
- The token to stop returning events at.limit
- The maximum number of events to return. Defaults to 10
.filter
- A JSON RoomEventFilter to filter returned events with.dir
- The direction to return events from. Either f
for forwards or b
for backwards. Setting
diff --git a/latest/development/synapse_architecture/faster_joins.html b/latest/development/synapse_architecture/faster_joins.html
index 925ba53fe7..1c77bbc91f 100644
--- a/latest/development/synapse_architecture/faster_joins.html
+++ b/latest/development/synapse_architecture/faster_joins.html
@@ -153,7 +153,7 @@
/send_join
endpoint.
This is called a faster join, also known as a partial join. In these
notes we'll usually use the word "partial" as it matches the database schema.
False
, Synapse falls through to the next one. The value of the first
callback that does not return False
will be used. If this happens, Synapse will not call
any of the subsequent implementations of this callback.
+check_login_for_spam
First introduced in Synapse v1.87.0
+async def check_login_for_spam(
+ user_id: str,
+ device_id: Optional[str],
+ initial_display_name: Optional[str],
+ request_info: Collection[Tuple[Optional[str], str]],
+ auth_provider_id: Optional[str] = None,
+) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]
+
+Called when a user logs in.
+The arguments passed to this callback are:
+user_id
: The user ID the user is logging in withdevice_id
: The device ID the user is re-logging into.initial_display_name
: The device display name, if any.request_info
: A collection of tuples, which first item is a user agent, and which
+second item is an IP address. These user agents and IP addresses are the ones that were
+used during the login process.auth_provider_id
: The identifier of the SSO authentication provider, if any.If multiple modules implement this callback, they will be considered in order. If a
+callback returns synapse.module_api.NOT_SPAM
, Synapse falls through to the next one.
+The value of the first callback that does not return synapse.module_api.NOT_SPAM
will
+be used. If this happens, Synapse will not call any of the subsequent implementations of
+this callback.
Note: This will not be called when a user registers.
The example below is a module that implements the spam checker callback
check_event_for_spam
to deny any message sent by users whose Matrix user IDs are
diff --git a/latest/print.html b/latest/print.html
index 6e1e9d1859..300c12be4b 100644
--- a/latest/print.html
+++ b/latest/print.html
@@ -4663,6 +4663,29 @@ on this homeserver.
allow_device_name_lookup_over_federation: true
federation
The federation section defines some sub-options related to federation.
+The following options are related to configuring timeout and retry logic for one request, +independently of the others. +Short retry algorithm is used when something or someone will wait for the request to have an +answer, while long retry is used for requests that happen in the background, +like sending a federation transaction.
+client_timeout
: timeout for the federation requests. Default to 60s.max_short_retry_delay
: maximum delay to be used for the short retry algo. Default to 2s.max_long_retry_delay
: maximum delay to be used for the short retry algo. Default to 60s.max_short_retries
: maximum number of retries for the short retry algo. Default to 3 attempts.max_long_retries
: maximum number of retries for the long retry algo. Default to 10 attempts.Example configuration:
+federation:
+ client_timeout: 180s
+ max_short_retry_delay: 7s
+ max_long_retry_delay: 100s
+ max_short_retries: 5
+ max_long_retries: 20
+
+Options related to caching.
False
, Synapse falls through to the next one. The value of the first
callback that does not return False
will be used. If this happens, Synapse will not call
any of the subsequent implementations of this callback.
+check_login_for_spam
First introduced in Synapse v1.87.0
+async def check_login_for_spam(
+ user_id: str,
+ device_id: Optional[str],
+ initial_display_name: Optional[str],
+ request_info: Collection[Tuple[Optional[str], str]],
+ auth_provider_id: Optional[str] = None,
+) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]
+
+Called when a user logs in.
+The arguments passed to this callback are:
+user_id
: The user ID the user is logging in withdevice_id
: The device ID the user is re-logging into.initial_display_name
: The device display name, if any.request_info
: A collection of tuples, which first item is a user agent, and which
+second item is an IP address. These user agents and IP addresses are the ones that were
+used during the login process.auth_provider_id
: The identifier of the SSO authentication provider, if any.If multiple modules implement this callback, they will be considered in order. If a
+callback returns synapse.module_api.NOT_SPAM
, Synapse falls through to the next one.
+The value of the first callback that does not return synapse.module_api.NOT_SPAM
will
+be used. If this happens, Synapse will not call any of the subsequent implementations of
+this callback.
Note: This will not be called when a user registers.
The example below is a module that implements the spam checker callback
check_event_for_spam
to deny any message sent by users whose Matrix user IDs are
@@ -10926,7 +10976,6 @@ information.
from
(required) - The token to start returning events from. This token can be obtained from a prev_batch
or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.to
- The token to spot returning events at.to
- The token to stop returning events at.limit
- The maximum number of events to return. Defaults to 10
.filter
- A JSON RoomEventFilter to filter returned events with.dir
- The direction to return events from. Either f
for forwards or b
for backwards. Setting
@@ -15381,7 +15430,7 @@ present this information through a series of pretty graphs.
Still, it's probably worth investigating why we're getting users from the database that often, and whether it's possible to reduce the amount of queries we make by adjusting our cache factor(s).
The persist_events
transaction is responsible for saving new room events to the Synapse database, so can often show a high transaction duration.
The charts in the "Federation" section show information about incoming and outgoing federation requests. Federation data can be divided into two basic types:
See also MSC3902.
-The key idea is described by MSC706. This allows servers to +
The key idea is described by MSC3706. This allows servers to
request a lightweight response to the federation /send_join
endpoint.
This is called a faster join, also known as a partial join. In these
notes we'll usually use the word "partial" as it matches the database schema.