mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-27 07:50:57 +01:00
Remove calls to DifferentialRevision::loadRelations from commit workers
Summary: Remove ocurrences of `loadRelations` in workers. One was simply unnecesary, no subsequent call to `getReviewers` or `getCCPHIDs` was made. The other was replaced with the nicer `DifferentialRevisionQuery` using `needRelations` and `needReviewerStatus` (for future upgrade). Test Plan: Land a revision into a tracked repository and check the parser worker attached the commit correctly. For the owners worker I just checked it didn't crash into a hundred tiny pieces. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D6467
This commit is contained in:
parent
ee9fac5c8f
commit
8e0a975e3f
2 changed files with 8 additions and 3 deletions
|
@ -94,7 +94,6 @@ final class PhabricatorRepositoryCommitOwnersWorker
|
|||
if ($revision_id) {
|
||||
$revision = id(new DifferentialRevision())->load($revision_id);
|
||||
if ($revision) {
|
||||
$revision->loadRelationships();
|
||||
$revision_author_phid = $revision->getAuthorPHID();
|
||||
$revision_reviewedby_phid = $revision->loadReviewedBy();
|
||||
$commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
|
||||
|
|
|
@ -116,7 +116,14 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
|||
$lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id);
|
||||
$lock->lock(5 * 60);
|
||||
|
||||
$revision = id(new DifferentialRevision())->load($revision_id);
|
||||
// TODO: Check if a more restrictive viewer could be set here
|
||||
$revision = id(new DifferentialRevisionQuery())
|
||||
->withIDs(array($revision_id))
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->needRelationships(true)
|
||||
->needReviewerStatus(true)
|
||||
->executeOne();
|
||||
|
||||
if ($revision) {
|
||||
$commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV;
|
||||
id(new PhabricatorEdgeEditor())
|
||||
|
@ -124,7 +131,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
|||
->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID())
|
||||
->save();
|
||||
|
||||
$revision->loadRelationships();
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'INSERT IGNORE INTO %T (revisionID, commitPHID) VALUES (%d, %s)',
|
||||
|
|
Loading…
Reference in a new issue