0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed inactive themes not loading [WIP]

- Currently the new boot process breaks the loading of inactive themes because the theme loader event isn't wired until after the server.start event is fired
- This is a WIP fix, there needs to be some bigger refactoring of the boot process once the old process is gone
This commit is contained in:
Hannah Wolfe 2021-02-12 16:08:31 +00:00
parent 70486ccb4e
commit 21bea79848
3 changed files with 10 additions and 0 deletions

View file

@ -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');

View file

@ -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

View file

@ -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');
}