X-Git-Url: http://git.roojs.org/?p=Pman.Base;a=blobdiff_plain;f=Pman.php;h=cc8ccb1d7f3527fe08b3cc81a8e3bc3172550ef5;hp=97b75132165dc3756f7e8af92959fe3fa9c10533;hb=HEAD;hpb=76e3aa45b5c5754e2c96d60c9e756053a2c8f3f3 diff --git a/Pman.php b/Pman.php index 97b7513..013978d 100644 --- a/Pman.php +++ b/Pman.php @@ -548,9 +548,26 @@ 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"); + $locked = 0; + while ($cd->fetch()) { + if ($cd->State == 'Waiting for table metadata lock') { + $locked++; + } + if ($locked> 10) { + return true; + } + } + return false; + }