diff --git a/core/boot.js b/core/boot.js index 83125874de..46ed7e5e77 100644 --- a/core/boot.js +++ b/core/boot.js @@ -46,6 +46,10 @@ const initExpressApps = async () => { const parentApp = require('./server/web/parent/app')(); + // @TODO: fix this + const {events} = require('./server/lib/common'); + events.emit('themes.ready'); + debug('End: initExpressApps'); return parentApp; }; @@ -155,6 +159,7 @@ const bootGhost = async () => { // Announce Server Readiness logging.info('Ghost boot', (Date.now() - startTime) / 1000 + 's'); + debug('boot announcing readiness'); GhostServer.announceServerReadiness(); } catch (error) { const errors = require('@tryghost/errors'); diff --git a/core/frontend/services/themes/index.js b/core/frontend/services/themes/index.js index 35bd7882e7..f85f6decbd 100644 --- a/core/frontend/services/themes/index.js +++ b/core/frontend/services/themes/index.js @@ -27,6 +27,9 @@ module.exports = { events.on('server.start', function readAllThemesOnServerStart() { themeLoader.loadAllThemes(); }); + events.on('themes.ready', function readAllThemesOnServerStart() { + themeLoader.loadAllThemes(); + }); // Just read the active theme for now return themeLoader diff --git a/core/server/ghost-server.js b/core/server/ghost-server.js index 04c58996b0..b42486f20a 100644 --- a/core/server/ghost-server.js +++ b/core/server/ghost-server.js @@ -139,6 +139,7 @@ class GhostServer { }, 5000); } + debug('server announcing readiness'); return GhostServer.announceServerReadiness() .finally(() => { resolve(self); @@ -328,6 +329,7 @@ module.exports.announceServerReadiness = function (error = null) { message.started = false; message.error = error; } else { + debug('emit: server.start'); events.emit('server.start'); }