From 0586a73c6d0959f9a21c5a2154c6b220b570891a Mon Sep 17 00:00:00 2001 From: Naz Date: Mon, 27 Sep 2021 14:15:06 +0200 Subject: [PATCH] Exposed async route settings loading method refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings - There's no reason for the boot to block the event by loading route settings sychronously - The only leftover use of a sync loader might also be refactored in some way to avoid blocking the event loo - for example by caching the value on the service layer. --- core/boot.js | 2 +- core/server/services/route-settings/route-settings.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/boot.js b/core/boot.js index b6133ce96b..ce34470809 100644 --- a/core/boot.js +++ b/core/boot.js @@ -152,7 +152,7 @@ async function initDynamicRouting() { // We pass the frontend API version + the dynamic routes here, so that the frontend services are slightly less tightly-coupled const apiVersion = bridge.getFrontendApiVersion(); - const routeSettings = routeSettingsService.loadRouteSettingsSync(); + const routeSettings = await routeSettingsService.loadRouteSettings(); debug(`Frontend API Version: ${apiVersion}`); routing.bootstrap.start(apiVersion, routeSettings); diff --git a/core/server/services/route-settings/route-settings.js b/core/server/services/route-settings/route-settings.js index b14812193b..e46659d054 100644 --- a/core/server/services/route-settings/route-settings.js +++ b/core/server/services/route-settings/route-settings.js @@ -146,6 +146,7 @@ const init = function () { module.exports.init = init; module.exports.loadRouteSettingsSync = SettingsLoader.loadSettingsSync; +module.exports.loadRouteSettings = SettingsLoader.loadSettings; module.exports.api = { setFromFilePath: setFromFilePath,