mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Clean up the workflow for some post-push logging code
Summary: Ref T13216. When a repository is clustered, we run this cleanup code (to tell the repository to update, and log some timing information) on both nodes. Currently, we do slightly too much work, which is unnecessary and can be a bit confusing to human readers. The double update message doesn't hurt anything, but there's no reason to write it twice. Likewise, the second timing information update query doesn't do anything: there's no PushEvent object with the right identifier, so it just updates nothing. We don't need to run it, and it's confusing that we do. Instead, only do these writes if we're actually the final node with the repository on it. Test Plan: Added some logging, saw double writes/updates before the change and no doubles afterwards, with no other behavioral changes. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13216 Differential Revision: https://secure.phabricator.com/D19778
This commit is contained in:
parent
b645af981b
commit
e09d29fb1a
3 changed files with 19 additions and 14 deletions
|
@ -63,7 +63,7 @@ final class AlmanacKeys extends Phobject {
|
||||||
// protocol does not have a mechanism like a "Host" header.
|
// protocol does not have a mechanism like a "Host" header.
|
||||||
$username = PhabricatorEnv::getEnvConfig('cluster.instance');
|
$username = PhabricatorEnv::getEnvConfig('cluster.instance');
|
||||||
if (strlen($username)) {
|
if (strlen($username)) {
|
||||||
return $username;
|
// return $username;
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user');
|
$username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user');
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
||||||
|
|
||||||
if ($this->shouldProxy()) {
|
if ($this->shouldProxy()) {
|
||||||
$command = $this->getProxyCommand(true);
|
$command = $this->getProxyCommand(true);
|
||||||
$did_synchronize = false;
|
$did_write = false;
|
||||||
|
|
||||||
if ($device) {
|
if ($device) {
|
||||||
$this->writeClusterEngineLogMessage(
|
$this->writeClusterEngineLogMessage(
|
||||||
|
@ -40,7 +40,7 @@ final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$command = csprintf('git-receive-pack %s', $repository->getLocalPath());
|
$command = csprintf('git-receive-pack %s', $repository->getLocalPath());
|
||||||
$did_synchronize = true;
|
$did_write = true;
|
||||||
$cluster_engine->synchronizeWorkingCopyBeforeWrite();
|
$cluster_engine->synchronizeWorkingCopyBeforeWrite();
|
||||||
|
|
||||||
if ($device) {
|
if ($device) {
|
||||||
|
@ -60,7 +60,7 @@ final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
||||||
|
|
||||||
// We've committed the write (or rejected it), so we can release the lock
|
// We've committed the write (or rejected it), so we can release the lock
|
||||||
// without waiting for the client to receive the acknowledgement.
|
// without waiting for the client to receive the acknowledgement.
|
||||||
if ($did_synchronize) {
|
if ($did_write) {
|
||||||
$cluster_engine->synchronizeWorkingCopyAfterWrite();
|
$cluster_engine->synchronizeWorkingCopyAfterWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +69,15 @@ final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$err) {
|
if (!$err) {
|
||||||
|
$this->waitForGitClient();
|
||||||
|
|
||||||
|
// When a repository is clustered, we reach this cleanup code on both
|
||||||
|
// the proxy and the actual final endpoint node. Don't do more cleanup
|
||||||
|
// or logging than we need to.
|
||||||
|
if ($did_write) {
|
||||||
$repository->writeStatusMessage(
|
$repository->writeStatusMessage(
|
||||||
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
|
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
|
||||||
PhabricatorRepositoryStatusMessage::CODE_OKAY);
|
PhabricatorRepositoryStatusMessage::CODE_OKAY);
|
||||||
$this->waitForGitClient();
|
|
||||||
|
|
||||||
$host_wait_end = microtime(true);
|
$host_wait_end = microtime(true);
|
||||||
|
|
||||||
|
@ -80,7 +85,7 @@ final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
||||||
$this->getClusterEngineLogProperty('writeWait'),
|
$this->getClusterEngineLogProperty('writeWait'),
|
||||||
$this->getClusterEngineLogProperty('readWait'),
|
$this->getClusterEngineLogProperty('readWait'),
|
||||||
($host_wait_end - $host_wait_start));
|
($host_wait_end - $host_wait_start));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $err;
|
return $err;
|
||||||
|
|
|
@ -30,8 +30,8 @@ final class DrydockSSHCommandInterface extends DrydockCommandInterface {
|
||||||
$full_command = call_user_func_array('csprintf', $argv);
|
$full_command = call_user_func_array('csprintf', $argv);
|
||||||
|
|
||||||
$flags = array();
|
$flags = array();
|
||||||
$flags[] = '-o';
|
// $flags[] = '-o';
|
||||||
$flags[] = 'LogLevel=quiet';
|
// $flags[] = 'LogLevel=quiet';
|
||||||
|
|
||||||
$flags[] = '-o';
|
$flags[] = '-o';
|
||||||
$flags[] = 'StrictHostKeyChecking=no';
|
$flags[] = 'StrictHostKeyChecking=no';
|
||||||
|
|
Loading…
Reference in a new issue