synapse/tests/config
Eric Eastwood 5a9ca1e3d9
Introduce Clock.call_when_running(...) to include logcontext by default (#18944)
Introduce `Clock.call_when_running(...)` to wrap startup code in a
logcontext, ensuring we can identify which server generated the logs.

Background:

>  Ideally, nothing from the Synapse homeserver would be logged against the `sentinel` 
>  logcontext as we want to know which server the logs came from. In practice, this is not 
>  always the case yet especially outside of request handling. 
>   
>  Global things outside of Synapse (e.g. Twisted reactor code) should run in the 
>  `sentinel` logcontext. It's only when it calls into application code that a logcontext 
>  gets activated. This means the reactor should be started in the `sentinel` logcontext, 
>  and any time an awaitable yields control back to the reactor, it should reset the 
>  logcontext to be the `sentinel` logcontext. This is important to avoid leaking the 
>  current logcontext to the reactor (which would then get picked up and associated with 
>  the next thing the reactor does). 
>
> *-- `docs/log_contexts.md`

Also adds a lint to prefer `Clock.call_when_running(...)` over
`reactor.callWhenRunning(...)`

Part of https://github.com/element-hq/synapse/issues/18905
2025-09-22 10:27:59 -05:00
..
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test___main__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_api.py Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
test_appservice.py Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
test_background_update.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_base.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_cache.py Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
test_database.py Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
test_generate.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_load.py Add recaptcha_{private,public}_key_path config option (#17984) 2025-07-14 11:37:36 -05:00
test_oauth_delegation.py Stabilise MAS integration (#18759) 2025-08-04 15:48:45 +02:00
test_ratelimiting.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_registration_config.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_room_directory.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_server.py Fix a couple type annotations in the RootConfig/Config (#18409) 2025-05-13 10:22:15 -05:00
test_tls.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_util.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_workers.py Add --no-secrets-in-config command line option (#18092) 2025-02-25 16:26:01 +00:00
utils.py Add macaroon_secret_key_path config option (#17983) 2024-12-16 18:01:33 -06:00