[Issue] Stop flushing fpc when not asked for #38301
Labels
Area: Catalog
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Priority: P2
A defect with this priority could have functionality issues which are not to expectations.
Progress: done
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Triage: Dev.Experience
Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
This issue is automatically created based on existing pull request: #38215: Stop flushing fpc when not asked for
Description (*)
We found out by surprise today on Slack (thanks @benjamin-volle & @robinero) that running
bin/magento cache:clean
orbin/magento cache:flush
will always flush FPC (built-in or Varnish) entirely, even if you've only provided a type to be cleaned likeconfig
,layout
, ...I understand that yes, probably if one of those types get flushed, you'll most likely want to flush FPC as well, but let that be up to the user to decide by seeing if they provided the type
full_page
explicitly in the command.This fixes this.
Some history of this problem, flushing FPC via CLI got introduced at the request of #2025 and got fixed by c75c203
This PR enhances this a bit and will only dispatch those 2 events when either no types were provided in the command line or when
full_page
is one of the types provided.Related Pull Requests
Fixed Issues (if relevant)
No idea
Manual testing scenarios (*)
bin/magento cache:flush
andbin/magento cache:clean
=> expected to hit one of thosedie
statements introduced in step 1bin/magento cache:flush full_page
andbin/magento cache:clean full_page
=> expected to hit one of thosedie
statements introduced in step 1bin/magento cache:flush layout
andbin/magento cache:clean layout
=> expected to not hit one of thosedie
statements introduced in step 1Questions or comments
Since we introducedMagento\PageCache
in theMagento_Backend
module, should we addmagento/module-page-cache
as dependency in the Backend module'scomposer.json
file? We can also choose to hardcodefull_page
and don't use the constant, that's also an option ...Update: looks like the automated tests also picked this up, I already force-pushed a change to have it hardcoded instead of using a constant from another module, adding a dependency might be out of scope here.
I noticed that the New Relic module also listens for that
adminhtml_cache_flush_system
event, but it's done in theadminhtml/events.xml
file, so that should be fine since it's in theadminhtml
area. Running those cli commands wouldn't have triggered this observer anyways. So no regression there.Contribution checklist (*)
The text was updated successfully, but these errors were encountered: