From: Alan Date: Wed, 3 Apr 2024 03:44:36 +0000 (+0800) Subject: add lock code X-Git-Url: http://git.roojs.org/?p=Pman.Base;a=commitdiff_plain;h=ed19acb4f556f8fb76a5342344b0c661733c024b add lock code --- diff --git a/Pman.php b/Pman.php index 97b7513..3c4c119 100644 --- a/Pman.php +++ b/Pman.php @@ -548,9 +548,27 @@ class Pman extends HTML_FlexyFramework_Page } + /** + * while doing batch processes, the database sometimes get's locked up. + * if we are doing another batch process that can be avoided - we should just stop for a while.. + */ - - + function database_is_locked() + { + $cd = DB_DataObject::Factory('core_enum'); + $cd->query("show processlist"); + $cd->find(); + $locked = 0; + while ($cd->fetch()) { + if ($cd->State == 'Waiting for table metadata lock') { + $locked++; + } + if ($locked> 10) { + return true; + } + } + return false; + }