Merge pull request #8071 from nupplaphil/task/Lock_to_lock

Replace Core\Lock wrapper with DI::lock() method
This commit is contained in:
Hypolite Petovan 2020-01-08 14:25:46 -05:00 committed by GitHub
commit f67f398fe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 75 additions and 130 deletions

View file

@ -2060,7 +2060,7 @@ class Item
}
// To avoid timing problems, we are using locks.
$locked = Lock::acquire('item_insert_activity');
$locked = DI::lock()->acquire('item_insert_activity');
if (!$locked) {
Logger::log("Couldn't acquire lock for URI " . $item['uri'] . " - proceeding anyway.");
}
@ -2076,11 +2076,11 @@ class Item
} else {
// This shouldn't happen.
Logger::log('Could not insert activity for URI ' . $item['uri'] . ' - should not happen');
Lock::release('item_insert_activity');
DI::lock()->release('item_insert_activity');
return false;
}
if ($locked) {
Lock::release('item_insert_activity');
DI::lock()->release('item_insert_activity');
}
return true;
}
@ -2103,7 +2103,7 @@ class Item
}
// To avoid timing problems, we are using locks.
$locked = Lock::acquire('item_insert_content');
$locked = DI::lock()->acquire('item_insert_content');
if (!$locked) {
Logger::log("Couldn't acquire lock for URI " . $item['uri'] . " - proceeding anyway.");
}
@ -2121,7 +2121,7 @@ class Item
Logger::log('Could not insert content for URI ' . $item['uri'] . ' - should not happen');
}
if ($locked) {
Lock::release('item_insert_content');
DI::lock()->release('item_insert_content');
}
}