Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15395269
D18268.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D18268.diff
View Options
diff --git a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
--- a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
+++ b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
@@ -207,7 +207,7 @@
$this->synchronizeWorkingCopyFromDevices($fetchable);
} else {
- $this->synchornizeWorkingCopyFromRemote();
+ $this->synchronizeWorkingCopyFromRemote();
}
PhabricatorRepositoryWorkingCopyVersion::updateVersion(
@@ -231,7 +231,7 @@
// no way to tell which one has the "right" data. If we pick wrong, we
// might erase some or all of the data in the repository.
- // Since this is dangeorus, we refuse to guess unless there is only one
+ // Since this is dangerous, we refuse to guess unless there is only one
// device. If we're the only device in the group, we obviously must be
// a leader.
@@ -575,7 +575,7 @@
/**
* @task internal
*/
- private function synchornizeWorkingCopyFromRemote() {
+ private function synchronizeWorkingCopyFromRemote() {
$repository = $this->getRepository();
$device = AlmanacKeys::getLiveDevice();
diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
--- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
@@ -115,6 +115,52 @@
->setRepository($repository)
->synchronizeWorkingCopyBeforeRead();
+ $device = AlmanacKeys::getLiveDevice();
+ if ($device) {
+ $device_phid = $device->getPHID();
+ } else {
+ $device_phid = PhabricatorPHIDConstants::PHID_TYPE_VOID;
+ }
+
+ $read_lock = PhabricatorRepositoryWorkingCopyVersion::getReadLock(
+ $repository->getPHID(),
+ $device_phid);
+ $lock_wait = phutil_units('2 minutes in seconds');
+
+ if ($device) {
+ $this->logPull(
+ pht(
+ 'Waiting up to %s second(s) for a cluster read lock on "%s"...',
+ new PhutilNumber($lock_wait),
+ $device->getName()));
+ } else {
+ $this->logPull(
+ pht(
+ 'Waiting up to %s second(s) for a read lock...',
+ new PhutilNumber($lock_wait)));
+ }
+
+ try {
+ $start = PhabricatorTime::getNow();
+ $read_lock->lock($lock_wait);
+ $waited = (PhabricatorTime::getNow() - $start);
+
+ if ($waited) {
+ $this->logPull(
+ pht(
+ 'Acquired read lock after %s second(s).',
+ new PhutilNumber($waited)));
+ } else {
+ $this->logPull(pht('Acquired read lock immediately.'));
+ }
+ } catch (PhutilLockException $ex) {
+ throw new PhutilProxyException(
+ pht(
+ 'Failed to acquire read lock after waiting %s second(s).',
+ new PhutilNumber($lock_wait)),
+ $ex);
+ }
+
if (!$repository->isHosted()) {
$this->logPull(
pht(
@@ -143,6 +189,7 @@
}
}
+ $read_lock->unlock();
} catch (Exception $ex) {
$this->abortPull(
pht(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 4:29 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707981
Default Alt Text
D18268.diff (3 KB)
Attached To
Mode
D18268: Add a missing read lock
Attached
Detach File
Event Timeline
Log In to Comment