From 711f13660e547d83aa5a6fa9580bb07ed49d62fd Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 22 Apr 2016 03:58:54 -0700 Subject: [PATCH] Synchronize working copies before doing a "bypassCache" commit read Summary: Ref T4292. When the daemons make a query for repository information, we need to make sure the working copy on disk is up to date before we serve the response, since we might not have the inforamtion we need to respond otherwise. We do this automatically for almost all Diffusion methods, but this particular method is a little unusual and does not get this check for free. Add this check. Test Plan: - Made this code throw. - Ran `bin/repository reparse --message ...`, saw the code get hit. - Ran `bin/repository lookup-user ...`, saw this code get hit. - Made this code not throw. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4292 Differential Revision: https://secure.phabricator.com/D15783 --- .../conduit/DiffusionQueryCommitsConduitAPIMethod.php | 3 +++ .../PhabricatorRepositoryManagementLookupUsersWorkflow.php | 1 + .../PhabricatorRepositoryCommitMessageParserWorker.php | 1 + 3 files changed, 5 insertions(+) diff --git a/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php index a71b21a724..bb205aad32 100644 --- a/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php @@ -42,6 +42,9 @@ final class DiffusionQueryCommitsConduitAPIMethod ->executeOne(); if ($repository) { $query->withRepository($repository); + if ($bypass_cache) { + $repository->synchronizeWorkingCopyBeforeRead(); + } } } diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php index 949fd96141..e02a8dc05c 100644 --- a/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php @@ -43,6 +43,7 @@ final class PhabricatorRepositoryManagementLookupUsersWorkflow )), 'diffusion.querycommits', array( + 'repositoryPHID' => $repo->getPHID(), 'phids' => array($commit->getPHID()), 'bypassCache' => true, )); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 25eedf0be2..4e92a0f32e 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -23,6 +23,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker )), 'diffusion.querycommits', array( + 'repositoryPHID' => $repository->getPHID(), 'phids' => array($commit->getPHID()), 'bypassCache' => true, 'needMessages' => true,