Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
| Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | protected function establishLiveConnection($mode) { | ||||
| // TODO: This should be testing if the mode is "r", but that would probably | // TODO: This should be testing if the mode is "r", but that would probably | ||||
| // break a lot of things. Perform a more narrow test for readonly mode | // break a lot of things. Perform a more narrow test for readonly mode | ||||
| // until we have greater certainty that this works correctly most of the | // until we have greater certainty that this works correctly most of the | ||||
| // time. | // time. | ||||
| if ($is_readonly) { | if ($is_readonly) { | ||||
| $connection->setReadOnly(true); | $connection->setReadOnly(true); | ||||
| } | } | ||||
| // Unless this is a script running from the CLI: | |||||
| // - (T10849) Prevent any query from running for more than 30 seconds. | |||||
| // - (T11672) Use persistent connections. | |||||
| if (php_sapi_name() != 'cli') { | |||||
| // TODO: For now, disable this until after T11044: it's better at high | |||||
| // load, but causes us to use slightly more connections at low load and | |||||
| // is pushing users over limits like MySQL "max_connections". | |||||
| $use_persistent = false; | |||||
| $connection | |||||
| ->setQueryTimeout(30) | |||||
| ->setPersistent($use_persistent); | |||||
| } | |||||
| return $connection; | return $connection; | ||||
| } | } | ||||
| private function newClusterConnection($application, $database, $mode) { | private function newClusterConnection($application, $database, $mode) { | ||||
| $master = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication( | $master = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication( | ||||
| $application); | $application); | ||||
| if ($master && !$master->isSevered()) { | if ($master && !$master->isSevered()) { | ||||
| ▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines | |||||