Skip to content

Avoid stale-if-error in FrameworkBundle's HttpCache if kernel.debug = true #35299

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

Merged
merged 1 commit into from
Jan 10, 2020

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Jan 10, 2020

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #24248 (maybe?)
License MIT
Doc PR

When working with the HttpCache in development, error messages may not become visible if a public response has been successfully generated for the same URL before.

This is because the HttpCache from the HttpKernel component by default sets stale_if_error to 60 seconds.

At least when using the HttpCache subclass from the FrameworkBundle, we know about the kernel.debug setting and its intention to support local development. In that case, we could set the default stale-if-error value to 0.

@fabpot
Copy link
Member

fabpot commented Jan 10, 2020

Thank you @mpdude.

fabpot added a commit that referenced this pull request Jan 10, 2020
…ernel.debug = true (mpdude)

This PR was merged into the 3.4 branch.

Discussion
----------

Avoid `stale-if-error` in FrameworkBundle's HttpCache if kernel.debug = true

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #24248 (maybe?)
| License       | MIT
| Doc PR        |

When working with the `HttpCache` in development, error messages may not become visible if a `public` response has been successfully generated for the same URL before.

This is because the `HttpCache` from the `HttpKernel` component by default sets `stale_if_error` to 60 seconds.

At least when using the `HttpCache` subclass from the `FrameworkBundle`, we know about the `kernel.debug` setting and its intention to support local development. In that case, we could set the *default* `stale-if-error` value to 0.

Commits
-------

3a23ec8 Avoid stale-if-error if kernel.debug = true, because it hides errors
@fabpot fabpot merged commit 3a23ec8 into symfony:3.4 Jan 10, 2020
@mpdude mpdude deleted the no-stale-if-error-in-debug branch January 10, 2020 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants