Added a not on media inlining perf improvement

refs https://github.com/TryGhost/Toolbox/issues/524

- Fetching media from a remote server is an expensive network operation. Given there's probability for the content to reuse the same image in different posts or in multiple places, we could save on extra fetches by adding caching to the remote media fetch method
This commit is contained in:
Naz 2023-03-08 14:16:28 +08:00
parent 831a76505c
commit 93ea9a2976
No known key found for this signature in database

View File

@ -40,6 +40,8 @@ class ExternalMediaInliner {
* @returns {Promise<Object>}
*/
async #getRemoteMedia(requestURL) {
// @NOTE: this is the most expensive operation in the whole inlining process
// we should consider caching the results to improve performance
try {
return await request(requestURL, {
followRedirect: true,