From f21a00a3159e6e0154de8e27f7787864e6bbb4ea Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Sep 2020 13:34:50 -0700 Subject: [PATCH] Fix an out-of-order issue in the new update-during-publish behavior Summary: Ref T13552. The Herald field "Accepted Differential revision" (and similar fields) depend on the task/revision update steps running before Herald executes. Herald currently executes first, so it never sees associated revisions. Swap this order. Test Plan: Published a commit, got a clean parse/import. Will test with production rules ("Cowboy Commits"). Maniphest Tasks: T13552 Differential Revision: https://secure.phabricator.com/D21468 --- .../worker/PhabricatorRepositoryCommitPublishWorker.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php index 846eb7987a..9d70e3db1c 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php @@ -67,10 +67,17 @@ final class PhabricatorRepositoryCommitPublishWorker return; } - $this->applyTransactions($viewer, $repository, $commit); + // NOTE: Close revisions and tasks before applying transactions, because + // we want a side effect of closure (the commit being associated with + // a revision) to occur before a side effect of transactions (Herald + // executing). The close methods queue tasks for the actual updates to + // commits/revisions, so those won't occur until after the commit gets + // transactions. $this->closeRevisions($viewer, $commit); $this->closeTasks($viewer, $commit); + + $this->applyTransactions($viewer, $repository, $commit); } private function applyTransactions(