@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.

When a large number of commits need to be marked as published, issue the lookup query in chunks

Summary: See PHI1474. This query can become large enough to exceed reasonable packet limits. Chunk the query so it is split up if we have too many identifiers.

Test Plan: Ran `bin/repository refs ...` on a repository with no new commits and a repository with some new commits.

Differential Revision: https://secure.phabricator.com/D20853

+23 -9
+23 -9
src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
··· 498 498 private function setCloseFlagOnCommits(array $identifiers) { 499 499 $repository = $this->getRepository(); 500 500 $commit_table = new PhabricatorRepositoryCommit(); 501 - $conn_w = $commit_table->establishConnection('w'); 501 + $conn = $commit_table->establishConnection('w'); 502 502 503 503 $vcs = $repository->getVersionControlSystem(); 504 504 switch ($vcs) { ··· 515 515 throw new Exception(pht("Unknown repository type '%s'!", $vcs)); 516 516 } 517 517 518 - $all_commits = queryfx_all( 519 - $conn_w, 520 - 'SELECT id, phid, commitIdentifier, importStatus FROM %T 521 - WHERE repositoryID = %d AND commitIdentifier IN (%Ls)', 522 - $commit_table->getTableName(), 523 - $repository->getID(), 524 - $identifiers); 518 + $identifier_tokens = array(); 519 + foreach ($identifiers as $identifier) { 520 + $identifier_tokens[] = qsprintf( 521 + $conn, 522 + '%s', 523 + $identifier); 524 + } 525 + 526 + $all_commits = array(); 527 + foreach (PhabricatorLiskDAO::chunkSQL($identifier_tokens) as $chunk) { 528 + $rows = queryfx_all( 529 + $conn, 530 + 'SELECT id, phid, commitIdentifier, importStatus FROM %T 531 + WHERE repositoryID = %d AND commitIdentifier IN (%LQ)', 532 + $commit_table->getTableName(), 533 + $repository->getID(), 534 + $chunk); 535 + foreach ($rows as $row) { 536 + $all_commits[] = $row; 537 + } 538 + } 525 539 526 540 $closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE; 527 541 ··· 539 553 540 554 if (!($row['importStatus'] & $closeable_flag)) { 541 555 queryfx( 542 - $conn_w, 556 + $conn, 543 557 'UPDATE %T SET importStatus = (importStatus | %d) WHERE id = %d', 544 558 $commit_table->getTableName(), 545 559 $closeable_flag,