mirror of
https://github.com/friendica/friendica
synced 2025-04-26 14:30:13 +00:00
Replace Lock::release() with DI::lock()->release() and remove Core\Lock
This commit is contained in:
parent
634e657d23
commit
31457b8566
14 changed files with 33 additions and 74 deletions
|
@ -117,7 +117,7 @@ class Worker
|
|||
// Trying to fetch new processes - but only once when successful
|
||||
if (!$refetched && DI::lock()->acquire('worker_process', 0)) {
|
||||
self::findWorkerProcesses();
|
||||
Lock::release('worker_process');
|
||||
DI::lock()->release('worker_process');
|
||||
self::$state = self::STATE_REFETCH;
|
||||
$refetched = true;
|
||||
} else {
|
||||
|
@ -133,17 +133,17 @@ class Worker
|
|||
// Count active workers and compare them with a maximum value that depends on the load
|
||||
if (self::tooMuchWorkers()) {
|
||||
Logger::log('Active worker limit reached, quitting.', Logger::DEBUG);
|
||||
Lock::release('worker');
|
||||
DI::lock()->release('worker');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check free memory
|
||||
if (DI::process()->isMinMemoryReached()) {
|
||||
Logger::log('Memory limit reached, quitting.', Logger::DEBUG);
|
||||
Lock::release('worker');
|
||||
DI::lock()->release('worker');
|
||||
return;
|
||||
}
|
||||
Lock::release('worker');
|
||||
DI::lock()->release('worker');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ class Worker
|
|||
|
||||
$found = self::findWorkerProcesses();
|
||||
|
||||
Lock::release('worker_process');
|
||||
DI::lock()->release('worker_process');
|
||||
|
||||
if ($found) {
|
||||
$stamp = (float)microtime(true);
|
||||
|
@ -1178,7 +1178,7 @@ class Worker
|
|||
|
||||
// If there are already enough workers running, don't fork another one
|
||||
$quit = self::tooMuchWorkers();
|
||||
Lock::release('worker');
|
||||
DI::lock()->release('worker');
|
||||
|
||||
if ($quit) {
|
||||
return $added;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue