Page MenuHomePhabricator

D20607.id49172.diff
No OneTemporary

D20607.id49172.diff

diff --git a/src/daemon/PhutilDaemonHandle.php b/src/daemon/PhutilDaemonHandle.php
--- a/src/daemon/PhutilDaemonHandle.php
+++ b/src/daemon/PhutilDaemonHandle.php
@@ -494,14 +494,6 @@
));
}
- public function toDictionary() {
- return array(
- 'pid' => $this->getPID(),
- 'id' => $this->getDaemonID(),
- 'config' => $this->properties,
- );
- }
-
public function didExit() {
if ($this->shouldSendExitEvent) {
$this->dispatchEvent(self::EVENT_WILL_EXIT);
diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -15,12 +15,10 @@
private $traceMode;
private $traceMemory;
private $daemonize;
- private $piddir;
private $log;
private $libraries = array();
private $modules = array();
private $verbose;
- private $lastPidfile;
private $startEpoch;
private $autoscale = array();
private $autoscaleConfig = array();
@@ -99,7 +97,6 @@
$this->libraries = idx($config, 'load');
$this->log = idx($config, 'log');
$this->daemonize = idx($config, 'daemonize');
- $this->piddir = idx($config, 'piddir');
$this->config = $config;
@@ -112,21 +109,6 @@
$this->startEpoch = time();
- // Check this before we daemonize, since if it's an issue the child will
- // exit immediately.
- if ($this->piddir) {
- $dir = $this->piddir;
- try {
- Filesystem::assertWritable($dir);
- } catch (Exception $ex) {
- throw new Exception(
- pht(
- "Specified daemon PID directory ('%s') does not exist or is ".
- "not writable by the daemon user!",
- $dir));
- }
- }
-
if (!idx($config, 'daemons')) {
throw new PhutilArgumentUsageException(
pht('You must specify at least one daemon to start!'));
@@ -206,7 +188,6 @@
}
}
- $this->updatePidfile();
$this->updateMemory();
$this->waitForDaemonFutures($futures);
@@ -263,54 +244,6 @@
return $this->pools;
}
- private function updatePidfile() {
- if (!$this->piddir) {
- return;
- }
-
- $pidfile = $this->toDictionary();
-
- if ($pidfile !== $this->lastPidfile) {
- $this->lastPidfile = $pidfile;
- $pidfile_path = $this->piddir.'/daemon.'.getmypid();
- try {
- Filesystem::writeFile(
- $pidfile_path,
- phutil_json_encode($pidfile));
- } catch (Exception $ex) {
- // This write can fail if the disk is full. We already tested the
- // directory for writability on startup, so just ignore this and
- // move on rather than crashing. If the disk is full this error may
- // not make it to a log file, but at least we tried.
- $this->logMessage(
- 'PIDF',
- pht(
- 'Unable to update PID file: %s.',
- $ex->getMessage()));
- }
- }
- }
-
- public function toDictionary() {
- $daemons = array();
- foreach ($this->getDaemonPools() as $pool) {
- foreach ($pool->getDaemons() as $daemon) {
- if (!$daemon->isRunning()) {
- continue;
- }
-
- $daemons[] = $daemon->toDictionary();
- }
- }
-
- return array(
- 'pid' => getmypid(),
- 'start' => $this->startEpoch,
- 'config' => $this->config,
- 'daemons' => $daemons,
- );
- }
-
private function updateMemory() {
if (!$this->traceMemory) {
return;

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 26, 1:31 PM (1 w, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7565301
Default Alt Text
D20607.id49172.diff (3 KB)

Event Timeline