1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Turn "bypassCache" into a no-op in "diffusion.querycommits"

Summary: Ref T13552. The internal caller for this now uses "internal.commit.search", which is always authority-reading. No legitimate external caller should rely on the behavior of "bypassCache"; no-op it to simplify behavior.

Test Plan: Called "diffusion.querycommits", saw the same data as before.

Maniphest Tasks: T13552

Differential Revision: https://secure.phabricator.com/D21447
This commit is contained in:
epriestley 2020-08-12 12:09:32 -07:00
parent 3a80efa440
commit 7d6874d9f0

View file

@ -38,7 +38,6 @@ final class DiffusionQueryCommitsConduitAPIMethod
protected function execute(ConduitAPIRequest $request) {
$need_messages = $request->getValue('needMessages');
$bypass_cache = $request->getValue('bypassCache');
$viewer = $request->getUser();
$query = id(new DiffusionCommitQuery())
@ -53,12 +52,6 @@ final class DiffusionQueryCommitsConduitAPIMethod
->executeOne();
if ($repository) {
$query->withRepository($repository);
if ($bypass_cache) {
id(new DiffusionRepositoryClusterEngine())
->setViewer($viewer)
->setRepository($repository)
->synchronizeWorkingCopyBeforeRead();
}
}
}
@ -111,33 +104,7 @@ final class DiffusionQueryCommitsConduitAPIMethod
'hashes' => array(),
);
if ($bypass_cache) {
$lowlevel_commitref = id(new DiffusionLowLevelCommitQuery())
->setRepository($commit->getRepository())
->withIdentifier($commit->getCommitIdentifier())
->execute();
$dict['authorEpoch'] = $lowlevel_commitref->getAuthorEpoch();
$dict['author'] = $lowlevel_commitref->getAuthor();
$dict['authorName'] = $lowlevel_commitref->getAuthorName();
$dict['authorEmail'] = $lowlevel_commitref->getAuthorEmail();
$dict['committer'] = $lowlevel_commitref->getCommitter();
$dict['committerName'] = $lowlevel_commitref->getCommitterName();
$dict['committerEmail'] = $lowlevel_commitref->getCommitterEmail();
if ($need_messages) {
$dict['message'] = $lowlevel_commitref->getMessage();
}
foreach ($lowlevel_commitref->getHashes() as $hash) {
$dict['hashes'][] = array(
'type' => $hash->getHashType(),
'value' => $hash->getHashValue(),
);
}
}
if ($need_messages && !$bypass_cache) {
if ($need_messages) {
$dict['message'] = $commit_data->getCommitMessage();
}