Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,16 @@ def run_sighup(*args: Any, **kwargs: Any) -> None:
# Apply the cache config.
hs.config.caches.resize_all_caches()

# Load the OIDC provider metadatas, if OIDC is enabled.
if hs.config.oidc.oidc_enabled:
oidc = hs.get_oidc_handler()
# Loading the provider metadata also ensures the provider config is valid.
#
# FIXME: It feels a bit strange to validate and block on startup as one of these
# OIDC providers could be temporarily unavailable and cause Synapse to be unable
# to start.
await oidc.load_metadata()
Comment on lines +628 to +636
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this lived in synapse/app/homeserver.py -> setup() which is only for the SynapseHomeServer (main Synapse instance).

This has now moved to _base.start() which means it will run on workers and the main Synapse instance.

I can't really tell if this should be only be run on the main instance or not. Kinda feels like we should validate the provider config on any Synapse instance. This will cause every instance to contact the providers to fetch the metadata.


# Load the certificate from disk.
refresh_certificate(hs)

Expand Down
12 changes: 5 additions & 7 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,11 @@ def setup(
handle_startup_exception(e)

async def _start_when_reactor_running() -> None:
# TODO: Feels like this should be moved somewhere else.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that the correct conclusion is that this belongs only on the main Synapse instance (see #19056 (comment)). In that case, this PR should just remove this TODO with some context on why.

#
# Load the OIDC provider metadatas, if OIDC is enabled.
if hs.config.oidc.oidc_enabled:
oidc = hs.get_oidc_handler()
# Loading the provider metadata also ensures the provider config is valid.
await oidc.load_metadata()
"""
Specific to the `SynapseHomeServer` (main homeserver process).

Should be called once the reactor is running.
"""

await _base.start(hs, freeze)

Expand Down
Loading