Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As a follow-up to this issue https://www.drupal.org/project/commerce/issues/3011667 and related to this issue in reports module https://www.drupal.org/project/commerce_reports/issues/3085785 .
The reason for moving from Kerner::TERMINATE is just not to repond on the event on every single request to Drupal, because every ajax request, image thumbnail generation, REST requests and so on fire this event and it is unnecessary to respond always even when the service was not used.
Maybe I am wrong, I am opened to hear the other opinions.
The patch is attached.
Comment | File | Size | Author |
---|---|---|---|
move_from_kernel_teminate_to_destructable_interface.patch | 3.33 KB | a.dmitriiev | |
|
Comments
Comment #2
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedComment #3
bojanz CreditAttribution: bojanz at Centarro for Ny Media AS commentedAre you sure that DestructableInterface is smarter?
From what I see, RegisterServicesForDestructionPass adds services implementing DestructableInterface to KernelDestructionSubscriber.
And KernelDestructionSubscriber subscribes to KernelEvents::TERMINATE.
So it seems like the two approaches should be equivalent performance-wise?
Comment #4
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedAt least it checks if for this request the service was initialized in web/core/lib/Drupal/Core/EventSubscriber/KernelDestructionSubscriber.php:
And the code is not executed e.g. on image thumbnails generation.
Comment #6
bojanz CreditAttribution: bojanz at Centarro commentedOkay, let's proceed. It's less code in any case :) Thanks!