Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Refactor stale-while-revalidate code in HttpCache, add a (first?) test for it#22043

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
mpdude wants to merge2 commits intosymfony:masterfromwebfactory:http-cache-stale-while-revalidate
Closed

Refactor stale-while-revalidate code in HttpCache, add a (first?) test for it#22043

mpdude wants to merge2 commits intosymfony:masterfromwebfactory:http-cache-stale-while-revalidate

Conversation

@mpdude
Copy link
Contributor

@mpdudempdude commentedMar 17, 2017
edited
Loading

QA
Branch?2.8
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

I came up with this while trying to hunt a production bug related to handling of stale cache entries under the condition of a busy backend (also see#22033).

It's just a refactoring to make the code more readable plus a new test.

* After 10s, the cached response has become stale. Yet, we're still within the "stale_while_revalidate"
* timeout so we may serve the stale response.
*/
sleep(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

Sleeping for 20 seconds in total in this test is unacceptable. Is it possible to sleep for less, or don't sleep at all?

Copy link
Member

@javiereguiluzjaviereguiluzMar 17, 2017
edited
Loading

Choose a reason for hiding this comment

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

With PHPUnitBridge clock mocking, time passes instantly.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Doesn't@group time-sensitive / clock mocking solve this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It does indeed. I only checked the method annotations (none). Indeedtime-sensitive is set on the test class 👍

@mpdude
Copy link
ContributorAuthor

@nicolas-grekas should I be concerned because of the failing AppVeyor builds?

@fabpot
Copy link
Member

Thank you@mpdude.

@mpdudempdude deleted the http-cache-stale-while-revalidate branchMarch 23, 2017 05:35
$this->assertHttpKernelIsNotCalled();
$this->assertEquals(503,$this->response->getStatusCode());
$this->assertEquals('Old response',$this->response->getContent());
}
Copy link
Member

Choose a reason for hiding this comment

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

Dunno why, but this test breaks the HttpKernel test suite on windows (see appveyorhttps://ci.appveyor.com/project/fabpot/symfony/build/1.0.20167#L841), removing the test fixes it.

@chalasrchalasr mentioned this pull requestMar 30, 2017
chalasr added a commit to chalasr/symfony that referenced this pull requestMar 30, 2017
…ttpCache, add a (first?) test for it (mpdude)"This reverts commit426a666, reversingchanges made to05933f3.
chalasr added a commit to chalasr/symfony that referenced this pull requestMar 30, 2017
…ttpCache, add a (first?) test for it (mpdude)"This reverts commit426a666, reversingchanges made to05933f3.
fabpot added a commit that referenced this pull requestApr 3, 2017
This PR was merged into the 3.3-dev branch.Discussion----------Fix HttpCache test| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | no| Fixed tickets |#22043 (comment)| License       | MIT| Doc PR        | n/awill make appveyor green.Commits-------3178f50 Fix failing HttpCache test on windows
symfony-splitter pushed a commit to symfony/http-kernel that referenced this pull requestApr 3, 2017
This PR was merged into the 3.3-dev branch.Discussion----------Fix HttpCache test| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | no| Fixed tickets |symfony/symfony#22043 (comment)| License       | MIT| Doc PR        | n/awill make appveyor green.Commits-------3178f50 Fix failing HttpCache test on windows
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@chalasrchalasrchalasr left review comments

+1 more reviewer

@jakzaljakzaljakzal left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@mpdude@fabpot@javiereguiluz@jakzal@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp