mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Carefully avoid the harbormaster/differential race
Summary: Ref T8650. This should stop the problem, but isn't a root cause fix. See discussion on the task. Test Plan: Made some local diffs, but this is a bit hard to reproduce reliably. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8650 Differential Revision: https://secure.phabricator.com/D13441
This commit is contained in:
parent
5f99d79c5d
commit
db1bc7fd7f
2 changed files with 55 additions and 35 deletions
|
@ -585,6 +585,8 @@ final class DifferentialTransactionEditor
|
|||
'a race?'));
|
||||
}
|
||||
|
||||
// TODO: This can race with diff updates, particularly those from
|
||||
// Harbormaster. See discussion in T8650.
|
||||
$diff->setRevisionID($object->getID());
|
||||
$diff->save();
|
||||
|
||||
|
@ -593,6 +595,8 @@ final class DifferentialTransactionEditor
|
|||
// the old (`null`) container.
|
||||
|
||||
// TODO: This is a bit iffy, maybe we can find a cleaner approach?
|
||||
// In particular, this could (rarely) be overwritten by Harbormaster
|
||||
// workers.
|
||||
$table = new HarbormasterBuildable();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
queryfx(
|
||||
|
|
|
@ -406,15 +406,34 @@ final class HarbormasterBuildEngine extends Phobject {
|
|||
$should_publish = $did_update &&
|
||||
$new_status != HarbormasterBuildable::STATUS_BUILDING &&
|
||||
!$buildable->getIsManualBuildable();
|
||||
if ($should_publish) {
|
||||
|
||||
if (!$should_publish) {
|
||||
return;
|
||||
}
|
||||
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($buildable->getBuildablePHID()))
|
||||
->executeOne();
|
||||
if (!$object) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Publishing these transactions is causing a race. See T8650.
|
||||
// We shouldn't be publishing to diffs anyway.
|
||||
if ($object instanceof DifferentialDiff) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($object instanceof PhabricatorApplicationTransactionInterface) {
|
||||
$template = $object->getApplicationTransactionTemplate();
|
||||
if ($template) {
|
||||
if (!$template) {
|
||||
return;
|
||||
}
|
||||
|
||||
$template
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_BUILDABLE)
|
||||
->setMetadataValue(
|
||||
|
@ -441,9 +460,6 @@ final class HarbormasterBuildEngine extends Phobject {
|
|||
$object->getApplicationTransactionObject(),
|
||||
array($template));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function releaseAllArtifacts(HarbormasterBuild $build) {
|
||||
$targets = id(new HarbormasterBuildTargetQuery())
|
||||
|
|
Loading…
Reference in a new issue