Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpFoundation] add stale while revalidate cache header #45166

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

Conversation

remilemonnier
Copy link

@remilemonnier remilemonnier commented Jan 25, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets Feat (#45036)
License MIT
Doc PR symfony/symfony-docs#...

This PR allow support for RFC5861.
Meaning you can now use stale_while_revalidate and stale_if_error
https://httpwg.org/specs/rfc5861.html

Very interesting doc from Fastly on the subject:
https://developer.fastly.com/learning/concepts/stale/

Link to the issue
#45036

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot carsonbot changed the title [cache] #45109 add stale while revalidate cache header [Cache] #45109 add stale while revalidate cache header Jan 25, 2022
@carsonbot carsonbot changed the title [Cache] #45109 add stale while revalidate cache header [HttpFoundation] #45109 add stale while revalidate cache header Jan 25, 2022
@nicolas-grekas nicolas-grekas changed the title [HttpFoundation] #45109 add stale while revalidate cache header [Cache] add stale while revalidate cache header Jan 25, 2022
@nicolas-grekas
Copy link
Member

Because this is a new feature, please target 6.1 (and then you can use static for the return type, since php 8 is the min version)

@nicolas-grekas nicolas-grekas changed the title [Cache] add stale while revalidate cache header [HttpFoundation] add stale while revalidate cache header Jan 25, 2022
@nandi95
Copy link

nandi95 commented Jan 25, 2022

Because this is a new feature, please target 6.1 (and then you can use static for the return type, since php 8 is the min version)

This seems backward compatible right? Isn't this meant to go to 5.x? (perhaps even lower).
Correct me if I'm wrong... I'm not entirely sure what processes there are to merge new features and bug fixes into compatible and supported branches.
https://symfony.com/doc/current/contributing/code/pull_requests.html#choose-the-right-branch
https://symfony.com/doc/current/contributing/code/maintenance.html

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 25, 2022

This is a new feature, so this is for 6.1.
All the other branches are for bugfixes only (and adding a new method is never a bugfix)

src/Symfony/Component/HttpFoundation/Response.php Outdated Show resolved Hide resolved

if (isset($options['stale_if_error'])) {
$this->setStaleIfError($options['stale_if_error']);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed, the next foreach will do it IIUC

@remilemonnier
Copy link
Author

This is a new feature, so this is for 6.1. All the other branches are for bugfixes only (and adding a new method is never a bugfix)

Ok I'll change my PR for 6.1

@remilemonnier remilemonnier changed the base branch from 5.4 to 6.1 January 25, 2022 14:51
@remilemonnier remilemonnier force-pushed the feat/45036-add-stale-while-revalidate-header branch from 5f16138 to 76a67f6 Compare January 25, 2022 16:22
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you update the HttpFoundation's CHANGELOG file?

@nicolas-grekas nicolas-grekas modified the milestones: 5.4, 6.1 Jan 26, 2022
@remilemonnier remilemonnier force-pushed the feat/45036-add-stale-while-revalidate-header branch 3 times, most recently from e0e9849 to 3bc8119 Compare January 27, 2022 15:50
@remilemonnier
Copy link
Author

LGTM. Can you update the HttpFoundation's CHANGELOG file?

Done for the changelog
I also rebased my PR
What is wrong for Psalm?

src/Symfony/Component/HttpFoundation/Response.php Outdated Show resolved Hide resolved
src/Symfony/Component/HttpFoundation/Response.php Outdated Show resolved Hide resolved
@remilemonnier remilemonnier force-pushed the feat/45036-add-stale-while-revalidate-header branch from 3bc8119 to 1be75f9 Compare February 1, 2022 07:56
@remilemonnier remilemonnier force-pushed the feat/45036-add-stale-while-revalidate-header branch from 1be75f9 to db553fb Compare February 7, 2022 09:22
@fabpot
Copy link
Member

fabpot commented Mar 26, 2022

Thank you @remilemonnier.

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.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.