meilisearch / strapi-plugin-meilisearch

A strapi plugin to add your collections to Meilisearch
https://meilisearch.com
MIT License
223 stars 58 forks source link

updateContentTypeInMeiliSearch duplicates lifecycle methods #925

Open jbendkowski opened 6 months ago

jbendkowski commented 6 months ago

Description Based on my experience with the Meilisearch plugin, it appears that multiple invocations of the service updateContentTypeInMeiliSearch method (which adds all entries from a contentType) cause each index update to be executed as many times as the addContentTypeInMeiliSearch method has been called since the server was started. I suggest adding a check to skip lifecycle subscriptions if the contentType has already been added. This could prevent the duplication of lifecycle methods and ensure that each index update is only executed once.

Environment:

francois-demory commented 1 month ago

I was going to post the same issue. Moreover, when you update the index from the plugin settings with the "update" button. It duplicates the subscription too.