X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/fa90ece530c124df72ad1fa4645892b62b107be6..02f02c4ca4c0b30e83033a4179cb6f94192ab743:/lib/init-website.php diff --git a/lib/init-website.php b/lib/init-website.php index 445bbc7c..bcf3ebf7 100644 --- a/lib/init-website.php +++ b/lib/init-website.php @@ -1,6 +1,17 @@ add('sleepCounter', 0); $iCurrentSleeping = $m->increment('sleepCounter'); } - if ($iCurrentSleeping >= CONST_ConnectionBucket_MaxSleeping) + if ($iCurrentSleeping >= CONST_ConnectionBucket_MaxSleeping || isBucketSleeping($aBucketKeys)) { // Too many threads sleeping already. This becomes a hard block. $fBucketVal = doBucket($aBucketKeys, CONST_ConnectionBucket_BlockLimit, CONST_ConnectionBucket_LeakRate, CONST_ConnectionBucket_BlockLimit); } else { + setBucketSleeping($aBucketKeys, true); sleep(($fBucketVal - CONST_ConnectionBucket_WaitLimit)/CONST_ConnectionBucket_LeakRate); $fBucketVal = doBucket($aBucketKeys, CONST_ConnectionBucket_LeakRate, CONST_ConnectionBucket_LeakRate, CONST_ConnectionBucket_BlockLimit); + setBucketSleeping($aBucketKeys, false); } $m->decrement('sleepCounter'); } @@ -48,3 +61,4 @@ } header('Content-type: text/html; charset=utf-8'); +