From 006eab7d078d01b5bbddefcfa65f22d36cde667a Mon Sep 17 00:00:00 2001 From: osaajani Date: Tue, 7 Jan 2020 18:06:57 +0100 Subject: [PATCH] Handle stopping on inactivity properly --- daemons/Phone.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/daemons/Phone.php b/daemons/Phone.php index 6e25423..f28577b 100644 --- a/daemons/Phone.php +++ b/daemons/Phone.php @@ -47,9 +47,8 @@ class Phone extends AbstractDaemon //Stop after 5 minutes of inactivity to avoid useless daemon if ( (microtime(true) - $this->last_message_at) > 5 * 60 ) { - $this->is_running = false; - $this->logger->info("End running"); - return true; + posix_kill(getmypid(), SIGTERM); //Send exit signal to the current process + return false; } $this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8');