0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added metric collection for URL service initialization time

- this should help us get more visibility into the URL service and the
  effect it has on bootup time
This commit is contained in:
Daniel Lockyer 2022-08-12 11:04:40 +02:00
parent d4860e7fe3
commit 7ea1c2591b
No known key found for this signature in database
GPG key ID: D21186F0B47295AD

View file

@ -105,11 +105,13 @@ async function initCore({ghostServer, config, bootLogger, frontend}) {
// The URLService is a core part of Ghost, which depends on models.
debug('Begin: Url Service');
const urlService = require('./server/services/url');
const urlServiceStart = Date.now();
// Note: there is no await here, we do not wait for the url service to finish
// We can return, but the site will remain in maintenance mode until this finishes
// This is managed on request: https://github.com/TryGhost/Ghost/blob/main/core/app.js#L10
urlService.init({
onFinished: () => {
bootLogger.metric('url-service', urlServiceStart);
bootLogger.log('URL Service Ready');
},
urlCache: !frontend // hacky parameter to make the cache initialization kick in as we can't initialize labs before the boot