la-haute-societe / craft-elasticsearch

Bring the power of Elasticsearch to your Craft CMS projects
Other
18 stars 14 forks source link

isIndexInSync will always result in a cache miss if index is not in sync #22

Closed aloco closed 2 years ago

aloco commented 2 years ago

Hi,

I have an installation maintaining around 60K entries.

I noticed slow response times in CP and figured out that https://github.com/la-haute-societe/craft-elasticsearch/blob/33782a380eace29d2e4ff842821b65475895e836/src/services/ElasticsearchService.php#L86-L127 causes SELECT COUNT(*) queries on every CP request which are slow. (>1 second with 60K entries)

Since you are using a boolean as cached value, getOrSet will always lead to a cache miss, as soon as false is getting cached which will trigger slow queries on every CP request making working with the dashboard very frustrating. You could use a string instead of a boolean to mitigate that problem.

nstCactus commented 2 years ago

Closed by 8f181cd5910f9bd98d9914aa28184bc584a185e4. Version 2.1.0 is out with that change.

Thanks you for your help on this!