The module checks whether domains exist:
count(Domain::loadMultiple()) > 0
(see https://git.drupalcode.org/project/eu-cookie-compliance/-/blob/8.x-1.x/e... )
This can lead to memory limit problems if thousands of domains exist. Entity query with limit can be used instead.

Comments

maximpodorov created an issue. See original summary.

svenryen’s picture

That would indeed be something we should have thought of. Thanks for catching this. Will have a look later. Patches are also welcome!

maximpodorov’s picture

Status: Active » Needs review
StatusFileSize
new1 KB

Status: Needs review » Needs work

The last submitted patch, 3: eu_cookie_compliance-domain_load-3206616-3.patch, failed testing. View results

svenryen’s picture

Status: Needs work » Needs review

svenryen’s picture

Status: Needs review » Fixed

Tested and committed. Thanks for the patch!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

maximpodorov’s picture

Actually, we don't get any benefit here as domains are config entities, and we need to load them all and filter or apply ranges. So the real optimization is to add the configuration variable which allows to decide whether cookie banners should be domain dependent.

svenryen’s picture

@maximpodorov, are you implying we should reopen this issue?

maximpodorov’s picture

I found that the fastest way is just to try to get the active domain. Any additional checks create more load.

maximpodorov’s picture

Moreover, iterating over all domains in EuCcClearCache.php can be too slow. I suggest to clear caches by invalidating cache tags.