Skip to content

Commit

Permalink
Update refresher.php
Browse files Browse the repository at this point in the history
  • Loading branch information
an0Nym0us63 committed Sep 22, 2023
1 parent 74f70da commit d305605
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions core/php/refresher.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
*/
declare (ticks = 1);

global $SIG;
$SIG = false;

function sig_handler($signo) {
global $SIG;
$SIG = true;
}

pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");

require_once dirname(__FILE__) . "/../../../../core/php/core.inc.php";
log::add('zwavejs', 'debug', 'Refresher');
if (isset($argv)) {
Expand Down Expand Up @@ -50,21 +63,20 @@
$starttime = strtotime('now');
$realNumber = 0;
while (true) {
usleep(round($sleep * 1000000));
try {
$eqLogic->pollValue($target);
log::add('zwavejs', 'debug', 'Refresh '. $eqLogic->getHumanName() . ' ' . $target . ' number : ' .$realNumber);
$realNumber +=1;
} catch (Exception $e) {

$realNumber +=1;
}
if ($SIG) {
break;
}
if ($realNumber >= $number){
break;
}
$cycleDuration = getmicrotime() - $cycleStartTime;
usleep(round($sleep * 1000000));
if ($SIG) {
break;
}
Expand Down

0 comments on commit d305605

Please sign in to comment.