1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Change lock in PullLocalDaemon to only lock on discovery

Summary:
The locks held by read-only pullLocal daemons were causing our discovery instance
to not get the lock and fail at discovery. We don't need to hold the lock while
pulling (only while discovering), so this moves the lock to the appropriate place.

Test Plan: tested in production

Reviewers: jungejason, epriestley, vrana

Reviewed By: jungejason

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2890
This commit is contained in:
Nick Harper 2012-06-29 16:19:32 -07:00
parent 30b06c1ad0
commit d70f8dad3f

View file

@ -136,19 +136,19 @@ final class PhabricatorRepositoryPullLocalDaemon
$callsign = $repository->getCallsign();
$this->log("Updating repository '{$callsign}'.");
$lock_name = get_class($this).':'.$callsign;
$lock = PhabricatorGlobalLock::newLock($lock_name);
$lock->lock();
$this->pullRepository($repository);
if (!$no_discovery) {
$lock_name = get_class($this).':'.$callsign;
$lock = PhabricatorGlobalLock::newLock($lock_name);
$lock->lock();
// TODO: It would be nice to discover only if we pulled something,
// but this isn't totally trivial.
$this->discoverRepository($repository);
}
$lock->unlock();
$lock->unlock();
}
$sleep_for = $repository->getDetail('pull-frequency', $min_sleep);
$retry_after[$id] = time() + $sleep_for;