System Information
- Strapi Version: 3.4.5
- Operating System: mac OS Big Sur 11.1
- Database: mySQL
- Node Version: 14.5.1
- NPM Version: 6.14.8
- Yarn Version: 1.22.10
I followed the tutorial of this video. Basically, data from Shopify gets added to the strapi API. I implemented it my find() Controller like this:
async find(ctx) {
let entities;
if (ctx.query._q) {
entities = await strapi.services.product.search(ctx.query);
} else {
entities = await strapi.services.product.find(ctx.query);
}
for (entity of entities) {
try {
await shopify.product.get(entity.shopifyId).then((product) => {
entity.shopify = {
id: product.id,
product_type: product.product_type,
admin_graphql_api_id: product.admin_graphql_api_id,
variants: product.variants
};
});
} catch (e) {
console.log(e);
}
}
return entities.map(entity => sanitizeEntity(entity, {model: strapi.models.product}));
},
But now, as there a some more products in shopify (34 products), every GET-Request of /products is very very slow. They take up to 15.000 miliseconds. Is there a way to improve the speed?
Thanks in Advance!