mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Fix an issue where we would try to release an unheld lock
Summary: Fixes T7484. If the lock failed, we'd still try to unlock it, which is incorrect. Test Plan: Ran two `bin/repository update X` in different windows, got proper LockException instead of indirect symptomatic "not locked by this process" exception. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7484 Differential Revision: https://secure.phabricator.com/D12253
This commit is contained in:
parent
898ccd7552
commit
e9886c4353
1 changed files with 31 additions and 29 deletions
|
@ -58,7 +58,7 @@ final class PhabricatorRepositoryManagementUpdateWorkflow
|
|||
$lock = PhabricatorGlobalLock::newLock($lock_name);
|
||||
|
||||
$lock->lock();
|
||||
|
||||
try {
|
||||
$no_discovery = $args->getArg('no-discovery');
|
||||
|
||||
id(new PhabricatorRepositoryPullEngine())
|
||||
|
@ -72,8 +72,8 @@ final class PhabricatorRepositoryManagementUpdateWorkflow
|
|||
}
|
||||
|
||||
// TODO: It would be nice to discover only if we pulled something, but
|
||||
// this isn't totally trivial. It's slightly more complicated with hosted
|
||||
// repositories, too.
|
||||
// this isn't totally trivial. It's slightly more complicated with
|
||||
// hosted repositories, too.
|
||||
|
||||
$repository->writeStatusMessage(
|
||||
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
|
||||
|
@ -90,6 +90,10 @@ final class PhabricatorRepositoryManagementUpdateWorkflow
|
|||
$repository->writeStatusMessage(
|
||||
PhabricatorRepositoryStatusMessage::TYPE_FETCH,
|
||||
PhabricatorRepositoryStatusMessage::CODE_OKAY);
|
||||
} catch (Exception $ex) {
|
||||
$lock->unlock();
|
||||
throw $ex;
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
$repository->writeStatusMessage(
|
||||
PhabricatorRepositoryStatusMessage::TYPE_FETCH,
|
||||
|
@ -98,8 +102,6 @@ final class PhabricatorRepositoryManagementUpdateWorkflow
|
|||
'message' => pht(
|
||||
'Error updating working copy: %s', $ex->getMessage()),
|
||||
));
|
||||
|
||||
$lock->unlock();
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue