1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02:00

Put a limit on the number of files showing in herald emails

Summary:
Sometimes a commit can be huge (like a branch cut in FB www which could have more than half a million files touched). It will generate some emails with size more than 30M, and it will take quite a while to just sort the files and to send out.
Put a hard limit here to avoid such cases. Probably only matters for FB right now, but still even for a small repo with several thousand files, it is a waste to send them all out. Not sure if there is any cleaner way to do it though.

Test Plan: Tried it in FB installtion.

Reviewers: lifeihuang, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8889
This commit is contained in:
Peng Li 2014-04-29 10:38:16 -07:00 committed by epriestley
parent cafd2dd6cb
commit 3a0694543d

View file

@ -138,8 +138,14 @@ final class PhabricatorRepositoryCommitHeraldWorker
? PhabricatorEnv::getProductionURI('/D'.$revision->getID())
: 'No revision.';
$limit = 1000;
$files = $adapter->loadAffectedPaths();
sort($files);
if (count($files) > $limit) {
array_splice($files, $limit);
$files[] = '(This commit affected more than 1000 files. '.
'Only 1000 are shown here and additional ones are truncated.)';
}
$files = implode("\n", $files);
$xscript_id = $xscript->getID();