minor #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
-------

8464bd0039 HttpCache lock update
This commit is contained in:
Fabien Potencier 2017-11-10 11:29:28 -08:00
commit e54c3c97b4

View File

@ -36,6 +36,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
private $traces = array();
/**
* Constructor
*
* The available options are:
*
* * debug: If true, the traces are added as a HTTP header to ease debugging
@ -702,11 +704,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
private function waitForLock(Request $request)
{
$wait = 0;
while ($this->store->isLocked($request) && $wait < 5000000) {
while ($this->store->isLocked($request) && $wait < 100) {
usleep(50000);
$wait += 50000;
++$wait;
}
return $wait < 5000000;
return $wait < 100;
}
}