synapse/docs/modules
Quentin Gliech 4af33015af
Fix joining remote rooms when a on_new_event callback is registered (#16973)
Since Synapse 1.76.0, any module which registers a `on_new_event`
callback would brick the ability to join remote rooms.
This is because this callback tried to get the full state of the room,
which would end up in a deadlock.

Related:
https://github.com/matrix-org/synapse-auto-accept-invite/issues/18

The following module would brick the ability to join remote rooms:

```python
from typing import Any, Dict, Literal, Union
import logging

from synapse.module_api import ModuleApi, EventBase

logger = logging.getLogger(__name__)

class MyModule:
    def __init__(self, config: None, api: ModuleApi):
        self._api = api
        self._config = config

        self._api.register_third_party_rules_callbacks(
            on_new_event=self.on_new_event,
        )

    async def on_new_event(self, event: EventBase, _state_map: Any) -> None:
        logger.info(f"Received new event: {event}")

    @staticmethod
    def parse_config(_config: Dict[str, Any]) -> None:
        return None
```

This is technically a breaking change, as we are now passing partial
state on the `on_new_event` callback.
However, this callback was broken for federated rooms since 1.76.0, and
local rooms have full state anyway, so it's unlikely that it would
change anything.
2024-03-06 16:00:20 +01:00
..
account_data_callbacks.md Add a module callback to react to account data changes (#12327) 2022-04-01 11:22:48 +02:00
account_validity_callbacks.md ModuleAPI SSO auth callbacks (#15207) 2023-12-01 14:31:50 +00:00
add_extra_fields_to_client_events_unsigned.md Add new module API for adding custom fields to events unsigned section (#16549) 2023-10-27 09:04:08 +00:00
background_update_controller_callbacks.md Make background updates controllable via a plugin (#11306) 2021-11-29 17:57:06 +01:00
index.md Document Synapse's behaviour when dealing with multiple modules (#11096) 2021-10-18 18:26:52 +02:00
password_auth_provider_callbacks.md Consolidate logic to check for deactivated users. (#15634) 2023-05-23 10:35:43 -04:00
porting_legacy_module.md Port the Password Auth Providers module interface to the new generic interface (#10548) 2021-10-13 11:21:52 +00:00
presence_router_callbacks.md Clarify presence router docs. (#16529) 2023-10-20 11:40:26 -04:00
spam_checker_callbacks.md Add login spam checker API (#15838) 2023-06-26 14:12:20 +00:00
third_party_rules_callbacks.md Fix joining remote rooms when a on_new_event callback is registered (#16973) 2024-03-06 16:00:20 +01:00
writing_a_module.md Fix typo 2023-12-13 16:37:10 +00:00