소스 검색

merged branch arnapou/2.0 (PR #3610)

Commits
-------

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

Discussion
----------

Branch 2.0 - Correct bad HttpCache behaviour when waiting for unlock.

I read the class Symfony\Component\HttpKernel\HttpCache\HttpCache and I found something which looks like a bug lines 518-520 (in lock method) :
$wait = 0;
while (is_file($lock) && $wait < 5000000) {
usleep($wait += 50000);
}
This code can wait at maximum 50000+100000+150000+.... 4950000 µs = more than 250 seconds !

I corrected like that :
$wait = 0;
while (is_file($lock) && $wait < 5000000) {
usleep(50000);
$wait += 50000
}

This code will wait 5 sec maximum.

This is more coherent if we read the following lines of this method.

---------------------------------------------------------------------------

by arnapou at 2012-03-15T20:09:13Z

Hope I succeded to do a correct PR.
One hour of manipulation in Github for 2 lines of code let me a bitter taste on the tongue...
I was closed to tell you "Do It Yourself" ... what a waste of time...
This interface is not obvious, even if we had already worked on svn/git on *nix.
Fabien Potencier 13 년 전
부모
커밋
3ed8979448
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

+ 2 - 1
src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

@@ -503,7 +503,8 @@ class HttpCache implements HttpKernelInterface
             // wait for the lock to be released
             $wait = 0;
             while (file_exists($lock) && $wait < 5000000) {
-                usleep($wait += 50000);
+                usleep(50000);
+                $wait += 50000;
             }
 
             if ($wait < 2000000) {