*/
namespace Friendica\Core;
-use Friendica\Core\Addon;
-use Friendica\Core\Config;
-use Friendica\Core\System;
-use Friendica\Core\Lock;
+use dba;
use Friendica\Database\DBM;
use Friendica\Model\Process;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
-use dba;
require_once 'include/dba.php';
}
// If possible we will fetch new jobs for this worker
- if (!$refetched && Lock::acquireLock('worker_process', 0)) {
+ if (!$refetched && Lock::acquire('worker_process', 0)) {
$stamp = (float)microtime(true);
$refetched = self::findWorkerProcesses($passing_slow);
self::$db_duration += (microtime(true) - $stamp);
- Lock::releaseLock('worker_process');
+ Lock::release('worker_process');
}
}
// To avoid the quitting of multiple workers only one worker at a time will execute the check
- if (Lock::acquireLock('worker', 0)) {
+ if (Lock::acquire('worker', 0)) {
$stamp = (float)microtime(true);
// Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) {
logger('Memory limit reached, quitting.', LOGGER_DEBUG);
return;
}
- Lock::releaseLock('worker');
+ Lock::release('worker');
self::$db_duration += (microtime(true) - $stamp);
}
dba::close($r);
$stamp = (float)microtime(true);
- if (!Lock::acquireLock('worker_process')) {
+ if (!Lock::acquire('worker_process')) {
return false;
}
self::$lock_duration = (microtime(true) - $stamp);
$found = self::findWorkerProcesses($passing_slow);
self::$db_duration += (microtime(true) - $stamp);
- Lock::releaseLock('worker_process');
+ Lock::release('worker_process');
if ($found) {
$r = dba::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
}
// If there is a lock then we don't have to check for too much worker
- if (!Lock::acquireLock('worker', 0)) {
+ if (!Lock::acquire('worker', 0)) {
return true;
}
// If there are already enough workers running, don't fork another one
$quit = self::tooMuchWorkers();
- Lock::releaseLock('worker');
+ Lock::release('worker');
if ($quit) {
return true;