Move oidc.load_metadata() startup into _base.start() (#19056)

Slightly related to ["clean-tenant
provisioning"](https://github.com/element-hq/synapse-small-hosts/issues/221)
as making startup cleaner, makes it more clear how to handle clean
provisioning.
This commit is contained in:
Eric Eastwood 2025-11-03 15:23:22 -06:00 committed by GitHub
parent e02a6f5e5d
commit 891acfd502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 8 deletions

1
changelog.d/19056.misc Normal file
View File

@ -0,0 +1 @@
Move `oidc.load_metadata()` startup into `_base.start()`.

View File

@ -648,6 +648,16 @@ async def start(hs: "HomeServer", *, freeze: bool = True) -> 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()
# Load the certificate from disk.
refresh_certificate(hs)

View File

@ -447,14 +447,6 @@ async def start(
False otherwise the homeserver cannot be garbage collected after `shutdown`.
"""
# TODO: Feels like this should be moved somewhere else.
#
# 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()
await _base.start(hs, freeze=freeze)
# TODO: Feels like this should be moved somewhere else.