1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Fix up hangup signal handling

This commit is contained in:
J. King 2021-07-05 20:21:04 -04:00
parent 37c58e186a
commit b8ac646d22
3 changed files with 6 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class Service {
do { do {
sleep((int) max(0, $t->getTimestamp() - time())); sleep((int) max(0, $t->getTimestamp() - time()));
pcntl_signal_dispatch(); pcntl_signal_dispatch();
if ($this->hangup) { if ($this->reload) {
$this->reload(); $this->reload();
} }
} while ($this->loop && $t->getTimestamp() > time()); } while ($this->loop && $t->getTimestamp() > time());
@ -57,9 +57,10 @@ class Service {
public function reload(): void { public function reload(): void {
$this->reload = false; $this->reload = false;
unset(Arsse::$user, Arsse::$db, Arsse::$conf, Arsse::$lang, Arsse::$obj, $this->drv); Arsse::$user = Arsse::$db = Arsse::$conf = Arsse::$lang = Arsse::$obj = $this->drv = null;
Arsse::bootstrap(); Arsse::bootstrap();
$this->__construct(); $this->__construct();
fwrite(\STDERR, Arsse::$lang->msg("Service.Reload").\PHP_EOL);
} }
public function checkIn(): bool { public function checkIn(): bool {
@ -126,6 +127,6 @@ class Service {
* *
* @codeCoverageIgnore */ * @codeCoverageIgnore */
protected function sigHup(int $signo): void { protected function sigHup(int $signo): void {
$this->hangup = true; $this->reload = true;
} }
} }

View file

@ -6,6 +6,7 @@
return [ return [
'CLI.Auth.Success' => 'Authentication successful', 'CLI.Auth.Success' => 'Authentication successful',
'CLI.Auth.Failure' => 'Authentication failed', 'CLI.Auth.Failure' => 'Authentication failed',
'Service.Reload' => 'Configuration reloaded',
'API.Miniflux.DefaultCategoryName' => "All", 'API.Miniflux.DefaultCategoryName' => "All",
'API.Miniflux.ImportSuccess' => 'Feeds imported successfully', 'API.Miniflux.ImportSuccess' => 'Feeds imported successfully',

View file

@ -12,6 +12,7 @@ const DOCROOT = BASE."tests".DIRECTORY_SEPARATOR."docroot".DIRECTORY_SEPARATOR;
ini_set("memory_limit", "-1"); ini_set("memory_limit", "-1");
ini_set("zend.assertions", "1"); ini_set("zend.assertions", "1");
ini_set("assert.exception", "true"); ini_set("assert.exception", "true");
// FIXME: Workaround for a bug in PCRE2 10.37
ini_set("pcre.jit", "0"); ini_set("pcre.jit", "0");
// FIXME: This is required by a dependency of Picofeed // FIXME: This is required by a dependency of Picofeed
error_reporting(\E_ALL & ~\E_DEPRECATED); error_reporting(\E_ALL & ~\E_DEPRECATED);