mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Added debug timing logs for HTML conversion library import+convert (#18912)
refs https://github.com/TryGhost/Product/issues/4086 - we're seeing random test timeouts on CI but not locally, these logs should help pinpoint if it's the require that's taking a long time, the conversion itself, or something else entirely
This commit is contained in:
parent
d88934938c
commit
3a975fee18
@ -133,11 +133,23 @@ module.exports = {
|
||||
const html = frame.data.pages[0].html;
|
||||
|
||||
if (frame.options.source === 'html' && !_.isEmpty(html)) {
|
||||
if (process.env.CI) {
|
||||
console.time('htmlToMobiledocConverter (page)'); // eslint-disable-line no-console
|
||||
}
|
||||
frame.data.pages[0].mobiledoc = JSON.stringify(mobiledoc.htmlToMobiledocConverter(html));
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('htmlToMobiledocConverter (page)'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
// normally we don't allow both mobiledoc+lexical but the model layer will remove lexical
|
||||
// if mobiledoc is already present to avoid migrating formats outside of an explicit conversion
|
||||
if (process.env.CI) {
|
||||
console.time('htmlToLexicalConverter (page)'); // eslint-disable-line no-console
|
||||
}
|
||||
frame.data.pages[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('htmlToLexicalConverter (page)'); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,11 +167,23 @@ module.exports = {
|
||||
const html = frame.data.posts[0].html;
|
||||
|
||||
if (frame.options.source === 'html' && !_.isEmpty(html)) {
|
||||
if (process.env.CI) {
|
||||
console.time('htmlToMobiledocConverter (post)'); // eslint-disable-line no-console
|
||||
}
|
||||
frame.data.posts[0].mobiledoc = JSON.stringify(mobiledoc.htmlToMobiledocConverter(html));
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('htmlToMobiledocConverter (post)'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
// normally we don't allow both mobiledoc+lexical but the model layer will remove lexical
|
||||
// if mobiledoc is already present to avoid migrating formats outside of an explicit conversion
|
||||
if (process.env.CI) {
|
||||
console.time('htmlToLexicalConverter (post)'); // eslint-disable-line no-console
|
||||
}
|
||||
frame.data.posts[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('htmlToLexicalConverter (post)'); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,17 @@ module.exports = {
|
||||
|
||||
get htmlToLexicalConverter() {
|
||||
try {
|
||||
return require('@tryghost/kg-html-to-lexical').htmlToLexical;
|
||||
if (process.env.CI) {
|
||||
console.time('require @tryghost/kg-html-to-lexical'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
const htmlToLexical = require('@tryghost/kg-html-to-lexical').htmlToLexical;
|
||||
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('require @tryghost/kg-html-to-lexical'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
return htmlToLexical;
|
||||
} catch (err) {
|
||||
throw new errors.InternalServerError({
|
||||
message: 'Unable to convert from source HTML to Lexical',
|
||||
|
@ -75,7 +75,17 @@ module.exports = {
|
||||
|
||||
get htmlToMobiledocConverter() {
|
||||
try {
|
||||
return require('@tryghost/html-to-mobiledoc').toMobiledoc;
|
||||
if (process.env.CI) {
|
||||
console.time('require @tryghost/html-to-mobiledoc'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
const toMobiledoc = require('@tryghost/html-to-mobiledoc').toMobiledoc;
|
||||
|
||||
if (process.env.CI) {
|
||||
console.timeEnd('require @tryghost/html-to-mobiledoc'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
return toMobiledoc;
|
||||
} catch (err) {
|
||||
return () => {
|
||||
throw new errors.InternalServerError({
|
||||
|
Loading…
Reference in New Issue
Block a user