Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / support / startup / PhabricatorClientConnectionLimit.php
blob4a66d0573955f00c5af48acac7a2123537f236fb
1 <?php
3 final class PhabricatorClientConnectionLimit
4 extends PhabricatorClientLimit {
6 protected function getBucketDuration() {
7 return 60;
10 protected function getBucketCount() {
11 return 15;
14 protected function shouldRejectConnection($score) {
15 // Reject connections if the cumulative score across all buckets exceeds
16 // the limit.
17 return ($score > $this->getLimit());
20 protected function getConnectScore() {
21 return 1;
24 protected function getPenaltyScore() {
25 return 0;
28 protected function getDisconnectScore(array $request_state) {
29 return -1;
32 protected function getRateLimitReason($score) {
33 $client_key = $this->getClientKey();
35 // NOTE: This happens before we load libraries, so we can not use pht()
36 // here.
38 return
39 "TOO MANY CONCURRENT CONNECTIONS\n".
40 "You (\"{$client_key}\") have too many concurrent ".
41 "connections.\n";