kentico-ericd / kontent-google-sheets-add-on

Using this Google Sheets add-on, you can import new content items in Kentico Kontent, or update existing items. This can be handy when migrating content from an external database or CMS, or if your editors prefer to work in spreadsheets.
MIT License
4 stars 3 forks source link

Investigate potential performance issues when importing #8

Closed kentico-ericd closed 3 years ago

kentico-ericd commented 3 years ago

GAS has an execution limit of ~5 minutes. Accessing services (ie reading from a Sheet) are performance intensive and we could save some execution time by possibly caching the data instead of reading cells in a loop.

Or, we could find a way to batch the import somehow.

kentico-ericd commented 3 years ago

Improvements in

💡 Idea: Request all items at the start of the import (instead of calling getExistingItem in a loop). The first request could potentially take a while, but reduces the number of API calls greatly.

kentico-ericd commented 3 years ago

https://github.com/Kentico/kontent-google-sheets-add-on/commit/b3e0795a0105fc893612d2624e9de270262340cc adds an option to cache all content items using the Deliver /items endpoint. This only works when trying to locate an existing item by name (external_id will still make a MAPI request since Deliver can't find that).

Caching the response from MAPI would be better, but that will require iterating through the pagination..

kentico-ericd commented 3 years ago

https://github.com/Kentico/kontent-google-sheets-add-on/commit/6c6625894729e0efcef7defe055dc16cfff036eb caches all content items from the MAPI endpoint, so we can now check cache whether we're updating items via name or external_id