Replace Lock::acquire() with DI::lock()->acquire()

This commit is contained in:
nupplaPhil 2020-01-07 00:20:31 +01:00
parent e56c8dcc3c
commit 634e657d23
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
13 changed files with 38 additions and 52 deletions

View file

@ -115,7 +115,7 @@ class Worker
}
// Trying to fetch new processes - but only once when successful
if (!$refetched && Lock::acquire('worker_process', 0)) {
if (!$refetched && DI::lock()->acquire('worker_process', 0)) {
self::findWorkerProcesses();
Lock::release('worker_process');
self::$state = self::STATE_REFETCH;
@ -129,7 +129,7 @@ class Worker
if (!self::getWaitingJobForPID()) {
self::$state = self::STATE_LONG_LOOP;
if (Lock::acquire('worker', 0)) {
if (DI::lock()->acquire('worker', 0)) {
// 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);
@ -933,7 +933,7 @@ class Worker
}
$stamp = (float)microtime(true);
if (!Lock::acquire('worker_process')) {
if (!DI::lock()->acquire('worker_process')) {
return false;
}
self::$lock_duration += (microtime(true) - $stamp);
@ -1172,7 +1172,7 @@ class Worker
}
// If there is a lock then we don't have to check for too much worker
if (!Lock::acquire('worker', 0)) {
if (!DI::lock()->acquire('worker', 0)) {
return $added;
}