Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always decorate Symfonys config_cache_factory service with WfdMetaConfigCacheFactory (Case 171239) #45

Merged
merged 3 commits into from
May 15, 2024

Conversation

MalteWunsch
Copy link
Member

@MalteWunsch MalteWunsch commented May 15, 2024

The WfdMetaConfigCacheFactory creates a cache that checks its freshness by:

  1. checking the "inner" cache with Symfony means
  2. if that is still fresh, the WfdMetaConfigCache queries the wfd_meta table in regard to the registered wfdMeta-resources like a DoctrineEntityClassResource for a Page entity.

Before this PR, the decoration only took place when always_expire_wfd_meta_resources was not set. This effectively disabled checking the wfdMeta-resources, at least in production environments. (The fact that one probably shouldn't use this configuration setting in production is another story.)

This PR configures the decoration independently of always_expire_wfd_meta_resources.

This should not break anything, as the decoration used to be configured always before the always_expire_wfd_meta_resources config setting was introduced in c7a2e2b.

Resolves #43.

…d always

The WfdMetaConfigCacheFactory creates a cache that checks its freshness by:
1. checking the "inner" cache with Symfony means
2. if that is still fresh, the WfdMetaConfigCache queries the wfd_meta table in regard to the registered wfdMeta-resources like a DoctrineEntityClassResource for a Page entity.

Previously, the decoration only took place when `always_expire_wfd_meta_resources` was not set. This effectively disabled checking the wfdMeta-resources, at least in production environments. (The fact that one probably shouldn't use this configuration setting in production is another story.)

This should not break anything, as the decoration used to happen always before the `always_expire_wfd_meta_resources` config setting was introduced in c7a2e2b.
"version = 3.9.0" seems slightly better than "3.14.0", as the deprecation was introduced (in another form) in 3.9.0 already.
@MalteWunsch MalteWunsch marked this pull request as ready for review May 15, 2024 15:44
@MalteWunsch
Copy link
Member Author

/cc @mpdude

@MalteWunsch MalteWunsch merged commit a1912d4 into 3.19.x May 15, 2024
6 checks passed
@MalteWunsch MalteWunsch deleted the 171239-always-use-wfdmetaconfigcachefactory branch May 15, 2024 15:48
MalteWunsch added a commit that referenced this pull request May 15, 2024
@mpdude
Copy link
Member

mpdude commented May 15, 2024

👌🏻

@mpdude
Copy link
Member

mpdude commented May 17, 2024

Any particular reason why you did not squash-merge this, as we usually do?

@MalteWunsch
Copy link
Member Author

No. Just clicked the merge button, and I hadn't changed the default merge strategy for this repository, yet.

(With your idea for a merge strategy, do I need to check the strategy each time before pressing the button? This one here should've been a squash merge, while #46 should have been (and was) a non-squash merge, right?)

mpdude added a commit that referenced this pull request Jul 1, 2024
#45 broke the `always_expire_wfd_meta_resources` feature in a subtle
way:

The change made the `WfdMetaConfigCacheFactory` decorate the regular
`config_cache_factory` service unconditionally. The idea was that the
`CacheBustingResourceChecker` would then be added when setting
`always_expire_wfd_meta_resources: true`, causing caches that rely on
`wfd_meta` to be refreshed every time.

What we missed was that `WfdMetaConfigCache` sorts the resources into
two groups - those for the regular freshness check (which happens by
means of the Symfony `ConfigCacheFactory`), and the "extra" resources
checked with `wfd_meta` data.

`WfdMetaResources` would always end up in the second group, which is
checked by `WfdMetaConfigCache`, and this check was not aware of
`ResourceChecker`s at all. This rendered the
`CacheBustingResourceChecker` useless, since it was never applied to
anything.

This PR fixes the problem by keeping `WfdMetaResource` instances in the
set of resources to be checked by the "inner" (regular) config cache
factory, where they can be picked up by `CacheBustingResourceChecker`.

It also gives a bit more clarity to how the `WfdMetaConfigCache`
actually works: It now behaves more cleanly like a decorator around the
"inner" `ConfigCache` instance, delegating the `isFresh()` check to that
implementation first and then running a second round of checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants