Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15425967
D14452.id34937.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14452.id34937.diff
View Options
diff --git a/src/daemon/PhutilDaemonHandle.php b/src/daemon/PhutilDaemonHandle.php
--- a/src/daemon/PhutilDaemonHandle.php
+++ b/src/daemon/PhutilDaemonHandle.php
@@ -370,8 +370,7 @@
// naturally be restarted after it exits, as though it had exited after an
// unhandled exception.
- $pid = $this->pid;
- exec("kill -INT {$pid}");
+ posix_kill($this->pid, SIGINT);
}
public function didReceiveGracefulSignal($signo) {
diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -184,7 +184,19 @@
$this->addDaemon($daemon, $config);
}
+ $i = 0;
+ $config_hash = $this->getConfigHash();
+
while (true) {
+ if (++$i % 10 == 0) {
+ $new_config_hash = $this->getConfigHash();
+
+ if ($config_hash != $new_config_hash) {
+ $this->didReceiveReloadSignal(SIGHUP);
+ $config_hash = $new_config_hash;
+ }
+ }
+
$futures = array();
foreach ($this->getDaemonHandles() as $daemon) {
$daemon->update();
@@ -217,6 +229,14 @@
exit($this->err);
}
+ private function getConfigHash() {
+ $config_entry = id(new PhabricatorConfigEntry())->loadOneWhere(
+ 'namespace = %s AND configKey = %s',
+ 'default',
+ 'config.hash');
+ return $config_entry->getValue();
+ }
+
private function addDaemon(PhutilDaemonHandle $daemon, array $config) {
$id = $daemon->getDaemonID();
$this->daemons[$id] = array(
@@ -296,7 +316,7 @@
if ((time() - $busy) < $scaleup_duration) {
// At least one daemon in the group was idle recently, so we have
- // not fullly
+ // not fully.
$should_scale = false;
break;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 24 2025, 6:46 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7719763
Default Alt Text
D14452.id34937.diff (1 KB)
Attached To
Mode
D14452: Add daemon overseer modules to allow daemons to be externally reloaded
Attached
Detach File
Event Timeline
Log In to Comment