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

IBX-301: Fixed manual cache clearing #51

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Conversation

mateuszbieniek
Copy link
Contributor

Question Answer
JIRA issue IBX-301
Type bug
Target Ibexa version v4.1
BC breaks no

Looks like the fix for bad cache cleared got lost on the way (#22 - not sure how).

Description from the previous PR:

When the cache:clear command is executed it is making a check if cache "is fresh":
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php#L132

When we execute rm -rf var/cache/prod/. beforehand cache:clear script is "tricked" into thinking that cache is fresh, as the request timestamp will be lower than Container File modification timestamp.

bulbo@bulboPC:/www/experience-3.3$ rm -rf var/cache/prod/.
bulbo@bulboPC:
/www/experience-3.3$ php bin/console c:c --env=prod

// Clearing the cache for the prod environment with debug
// false

$_SERVER['REQUEST_TIME']: ^ 1635942532
filemtime($containerFile): ^ 1635942536
time(): ^ 1635942536

This is due to that deleted files are firstly recreated (which will also affect filemtime($containerFile)) when cache:clear is called, and then Command logic executes.

To fix this, a whole var/cache/prod directory content should be removed.

@mateuszbieniek
Copy link
Contributor Author

mateuszbieniek commented Aug 18, 2022

Tests failing are not related to these PR changes.

@konradoboza konradoboza requested a review from a team August 18, 2022 08:55
@mateuszbieniek mateuszbieniek changed the title Fixed manual cache clearing IBX-301 - Fixed manual cache clearing Aug 18, 2022
@adamwojs adamwojs changed the title IBX-301 - Fixed manual cache clearing IBX-301: Fixed manual cache clearing Aug 18, 2022
@webhdx webhdx merged commit 69f48d3 into ibexa:4.1 Aug 18, 2022
@mateuszbieniek mateuszbieniek deleted the ibx-301-2 branch August 18, 2022 10:13
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.

7 participants