@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Juan Pablo Civile and committed by
epriestley
8e0a975e ee9fac5c

+8 -3
-1
src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php
··· 94 94 if ($revision_id) { 95 95 $revision = id(new DifferentialRevision())->load($revision_id); 96 96 if ($revision) { 97 - $revision->loadRelationships(); 98 97 $revision_author_phid = $revision->getAuthorPHID(); 99 98 $revision_reviewedby_phid = $revision->loadReviewedBy(); 100 99 $commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
+8 -2
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 116 116 $lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id); 117 117 $lock->lock(5 * 60); 118 118 119 - $revision = id(new DifferentialRevision())->load($revision_id); 119 + // TODO: Check if a more restrictive viewer could be set here 120 + $revision = id(new DifferentialRevisionQuery()) 121 + ->withIDs(array($revision_id)) 122 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 123 + ->needRelationships(true) 124 + ->needReviewerStatus(true) 125 + ->executeOne(); 126 + 120 127 if ($revision) { 121 128 $commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV; 122 129 id(new PhabricatorEdgeEditor()) ··· 124 131 ->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID()) 125 132 ->save(); 126 133 127 - $revision->loadRelationships(); 128 134 queryfx( 129 135 $conn_w, 130 136 'INSERT IGNORE INTO %T (revisionID, commitPHID) VALUES (%d, %s)',