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.
Problem: users need to clear caches (thereby rebuilding the service container) before a reaction rule will ever be executed. They might forget that and wonder why their rules never get executed.
We could rebuild the container whenever a rule is saved, but seems expensive and makes the UI slow. Maybe there is another way to update the list of events in the container without rebuilding?
Comments
Comment #2
fagoMaybe we can kick the process of in the backend? I think we'll have to do that automatically - that's really the expectation that you have when you edit something. Maybe it's fine though once we moved our UI to one-time save operation and an interim object in temp-store as views does, as you'll end up with less saves?
Comment #3
klausiNow that we have #2649500: Switch UI logic to use a temp-store rules are not saved that often.
Yes, we can trigger a container rebuild when the form is submitted in the UI. We can even do an optimisation: if our generic event subscriber in Rules is already registered to the event in the kernel/container then we don't need to rebuild.
Comment #4
fagoYep, we definitely should do that optimization and check whether there were already some rules listening on that event.
Comment #5
fagoTagging as (advanced) contributor task.
Comment #6
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedComment #7
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedHi,
I created a pull request here: https://github.com/fago/rules/pull/364
Comment #8
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedComment #9
dasjosee comments in the PR
Comment #10
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedThe issues should be fixed now.
Comment #11
fagoThanks, good work - committed!
Comment #13
fagooh, I just figured that we are doing this at the wrong place. The form is not the right place as this will miss any rules that get synced via CMI and/or are created via API. But moving this to a config entity crud event should be fine - once done so we should be able to remove the manual kernel rebuilds from EventIntegrationTest also.
-> created follow-up #2659990: Creating reaction rules via API does not trigger container rebuilds