1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Make the hard limit on the number of files showing in Herald emails a constant.

See: <https://github.com/facebook/phabricator/pull/587>

Reviewed by: epriestley
This commit is contained in:
austinkelleher 2014-05-01 10:21:57 -04:00 committed by epriestley
parent c9dc554cb9
commit eec0576793

View file

@ -3,6 +3,8 @@
final class PhabricatorRepositoryCommitHeraldWorker final class PhabricatorRepositoryCommitHeraldWorker
extends PhabricatorRepositoryCommitParserWorker { extends PhabricatorRepositoryCommitParserWorker {
const MAX_FILES_SHOWN_IN_EMAIL = 1000;
public function getRequiredLeaseTime() { public function getRequiredLeaseTime() {
// Herald rules may take a long time to process. // Herald rules may take a long time to process.
return phutil_units('4 hours in seconds'); return phutil_units('4 hours in seconds');
@ -138,13 +140,13 @@ final class PhabricatorRepositoryCommitHeraldWorker
? PhabricatorEnv::getProductionURI('/D'.$revision->getID()) ? PhabricatorEnv::getProductionURI('/D'.$revision->getID())
: 'No revision.'; : 'No revision.';
$limit = 1000; $limit = self::MAX_FILES_SHOWN_IN_EMAIL;
$files = $adapter->loadAffectedPaths(); $files = $adapter->loadAffectedPaths();
sort($files); sort($files);
if (count($files) > $limit) { if (count($files) > $limit) {
array_splice($files, $limit); array_splice($files, $limit);
$files[] = '(This commit affected more than 1000 files. '. $files[] = '(This commit affected more than '.$limit.' files. '.
'Only 1000 are shown here and additional ones are truncated.)'; 'Only '.$limit.' are shown here and additional ones are truncated.)';
} }
$files = implode("\n", $files); $files = implode("\n", $files);