- Issue created by @jonathanshaw
- Merge request !107#3497730: Add variation cache to registration validator β (Merged) created by john.oltman
- π¬π§United Kingdom jonathanshaw Stroud, UK
Nice!
/** * The default cache contexts to vary every cache item by. * * Tests can change the current user or the language within a single * test run, so ensure results are cached per user and per language. * * @var string[] */ protected array $cacheContexts = [ 'languages', 'user', ];
I wonder if this runs a risk of hiding cacheability bugs.
As an alternative we could override ::setCurrentUser() in RegistrationKernelTestBase and reset the validator cache when the current user changes.
/** * The default cache tags to invalidate every cache item by. * * Ensures results are recalculated any time registrations are added or * deleted. * * @var string[] */ protected array $cacheTags = [ 'registration_list', ];
Shouldn't this be the responsibility of any constraint validators that depend on existing registrations?
-
john.oltman β
committed 3a9fcc25 on 3.3.x
#3497730: Add variation cache to registration validator
-
john.oltman β
committed 3a9fcc25 on 3.3.x
- πΊπΈUnited States john.oltman
Thanks! I had the same thought on the cache tags and moved that into the HasRoom validator where it belonged in the first place. The worst that the cache contexts can do is result in less caching of validation results, which won't cause any bugs, but could reduce performance. In reality, the user context will be there already, and I don't think multiple languages will come into play for the typical page request, so it shouldn't matter. If you are worried about something else please explain further. Keep in mind the cache contexts you are seeing in this commit are only added to the variation cache, not to the validation results.
- Merge request !109#3497730: Add cache status to validation result β (Merged) created by john.oltman
-
john.oltman β
committed fee4efe2 on 3.3.x
#3497730: Add cache status to validation result
-
john.oltman β
committed fee4efe2 on 3.3.x
Automatically closed - issue fixed for 2 weeks with no activity.