mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +03:00
426cbeec0f
closes https://github.com/TryGhost/Ghost/issues/12791 closes https://github.com/TryGhost/Team/issues/566 https://github.com/TryGhost/Ghost/pull/12787 introduced a significant performance regression due to a misunderstanding of when Bookshelf calls `.format()` ([related upstream issue](https://github.com/bookshelf/bookshelf/issues/668)). We expected `.format()` to only be called on save but it's also called when Bookshelf performs fetching and eager loading which happens frequently. `.format()` can be a heavy method as it needs to parse and serialize html and markdown so it should be performed as infrequently as possible. - override `sync()` in the base model so we can call our own `.formatOnWrite()` method to transform attributes on `update` and `insert` operations - this was the only feasible location in Bookshelf I could find that is low enough level to not require modifying model instance attributes - gives models the option to perform heavy transform operations only when writing to the database compared to the usual `.format()` method that is also called on fetch in many situations |
||
---|---|---|
.. | ||
base | ||
plugins | ||
relations | ||
action.js | ||
api-key.js | ||
author.js | ||
email-batch.js | ||
email-recipient.js | ||
email.js | ||
index.js | ||
integration.js | ||
invite.js | ||
label.js | ||
member-email-change-event.js | ||
member-login-event.js | ||
member-paid-subscription-event.js | ||
member-payment-event.js | ||
member-status-event.js | ||
member-stripe-customer.js | ||
member-subscribe-event.js | ||
member.js | ||
mobiledoc-revision.js | ||
permission.js | ||
post.js | ||
posts-meta.js | ||
role.js | ||
session.js | ||
settings.js | ||
single-use-token.js | ||
snippet.js | ||
stripe-customer-subscription.js | ||
tag-public.js | ||
tag.js | ||
user.js | ||
webhook.js |