Skip to content

Commit e54c3c9

Browse files
committed
minor symfony#24913 HttpCache lock update (Felix Marezki)
This PR was merged into the 3.4 branch. Discussion ---------- HttpCache lock update simplification... I guess the original Author was trying to pursue something like a martingale (doubling) strategy (or in this case the increment over a constant factor) but well ... he did not. Instead a constant wait time was introduced, which means the wait is simply executed a 100 times over (in the worst case). And so I do not see a need for "5000000" and "+= 50000" to remain here. | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the 3.4, legacy code removals go to the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Commits ------- 8464bd0 HttpCache lock update
2 parents 11aff9a + 8464bd0 commit e54c3c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
3636
private $traces = array();
3737

3838
/**
39+
* Constructor
40+
*
3941
* The available options are:
4042
*
4143
* * debug: If true, the traces are added as a HTTP header to ease debugging
@@ -702,11 +704,11 @@ private function mayServeStaleWhileRevalidate(Response $entry)
702704
private function waitForLock(Request $request)
703705
{
704706
$wait = 0;
705-
while ($this->store->isLocked($request) && $wait < 5000000) {
707+
while ($this->store->isLocked($request) && $wait < 100) {
706708
usleep(50000);
707-
$wait += 50000;
709+
++$wait;
708710
}
709711

710-
return $wait < 5000000;
712+
return $wait < 100;
711713
}
712714
}

0 commit comments

Comments
 (0)