From: Alan Date: Wed, 3 Apr 2024 03:30:54 +0000 (+0800) Subject: database lock for frequent processes X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=0c9ec158754ed1a44c9af5c0ede778e857540fc6 database lock for frequent processes --- diff --git a/Heartbeat.php b/Heartbeat.php index 6a49092f..27c1bf87 100644 --- a/Heartbeat.php +++ b/Heartbeat.php @@ -20,6 +20,12 @@ class Pman_Core_Heartbeat extends Pman function post($req) { $this->initErrorHandling(); + + if ($this->database_is_locked()) { + die("FAILED"); + } + + $cd = DB_DataObject::Factory('core_enum'); $cd->setFrom(array( 'etype' => 'heartbeat', @@ -48,4 +54,6 @@ class Pman_Core_Heartbeat extends Pman // print_r($err); die("FAILED"); } + + } \ No newline at end of file diff --git a/Notify.php b/Notify.php index f524ff2f..55047c7a 100644 --- a/Notify.php +++ b/Notify.php @@ -178,6 +178,12 @@ class Pman_Core_Notify extends Pman function get($r,$opts=array()) { + + if ($this->database_is_locked()) { + die("LATER - DATABASE IS LOCKED"); + } + + $this->parseArgs($opts); //date_default_timezone_set('UTC'); diff --git a/NotifySend.php b/NotifySend.php index 0ba7692e..a7b68742 100644 --- a/NotifySend.php +++ b/NotifySend.php @@ -87,7 +87,9 @@ class Pman_Core_NotifySend extends Pman function get($id,$opts=array()) { - + if ($this->database_is_locked()) { + die("LATER - DATABASE IS LOCKED"); + } //print_r($opts); if (!empty($opts['DB_DataObject-debug'])) { DB_DataObject::debugLevel($opts['DB_DataObject-debug']);