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

The watcher doesn't rebuild the cache when necessary #52

Closed
seregazhuk opened this issue Apr 27, 2020 · 1 comment · Fixed by #54
Closed

The watcher doesn't rebuild the cache when necessary #52

seregazhuk opened this issue Apr 27, 2020 · 1 comment · Fixed by #54

Comments

@seregazhuk
Copy link
Member

Currently, the watcher rebuilds the whole container (with cache) only in --debug mode. Which is not used by default (for example, in skeleton).

And it leads to weird errors. For example, I have a controller. And I add a dependency to it. The watcher says that it detects the change and reloads the app. But, the container stays the same. The way the controller is built in the container is outdated. And I receive an error like this:

Too few arguments to function App\Controller\DefaultController::__construct()

I'm not sure that we need to use debug mode always for development. Because recreating a cache for any change looks like a bit overhead 🙈
@mmoreram do you have any ideas how to solve it? Or maybe I'm misusing the server and doing something wrong?

@mmoreram
Copy link
Member

@seregazhuk Thanks!

Good catch!

Watcher should always work with --debug, so the thing here would be to explicitly tell the watcher command to add the flag when executing the server in the background.

About the overhead, reloading the cache each time is the main practice in Symfony. Is OK. Basically, because all changes in the code might change the cache layer. As far I can remember, the cache layer is only rebuilt when cacheable files (YAML) change.

I wouldn't be worried about performance in this scenario.

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 a pull request may close this issue.

2 participants