From 5dfa513b62d37395039ddf60aecc867028b8f91f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 6 Jun 2017 04:22:18 +0000 Subject: [PATCH] Only wait when you have a timout value at all --- src/Util/Lock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/Lock.php b/src/Util/Lock.php index 63f9b5f973..af15e106d5 100644 --- a/src/Util/Lock.php +++ b/src/Util/Lock.php @@ -76,7 +76,7 @@ class Lock { $memcache->set($cachekey, getmypid(), MEMCACHE_COMPRESSED, 300); $got_lock = true; } - if (!$got_lock) { + if (!$got_lock AND ($timeout > 0)) { usleep($wait_sec * 1000000); } } while (!$got_lock AND ((time() - $start) < $timeout)); @@ -112,7 +112,7 @@ class Lock { dba::unlock(); - if (!$got_lock) { + if (!$got_lock AND ($timeout > 0)) { sleep($wait_sec); } } while (!$got_lock AND ((time() - $start) < $timeout)); -- 2.39.5