Page MenuHomePhabricator

D8040.diff
No OneTemporary

D8040.diff

Index: src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
===================================================================
--- src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
+++ src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
@@ -116,6 +116,14 @@
'When constructing clone URIs to show to users, Diffusion by '.
'default will not display a port assuming the default for your '.
'VCS. Explicitly declare when running on a non-standard port.')),
+ $this->newOption('diffusion.render-time-limit', 'int', null)
+ ->setSummary(pht('Time limit to render single file when browsing.'))
+ ->setDescription(
+ pht(
+ 'Rendering a file in diffusion browser could take a while.'.
+ 'This option limits time to render file. If this limit is '.
+ 'exceeded rendering finished and information being printed '.
+ 'about that the file is not fully displayed.')),
);
}
Index: src/applications/diffusion/controller/DiffusionBrowseFileController.php
===================================================================
--- src/applications/diffusion/controller/DiffusionBrowseFileController.php
+++ src/applications/diffusion/controller/DiffusionBrowseFileController.php
@@ -616,7 +616,33 @@
($show_blame),
$engine);
+ $time_limit = PhabricatorEnv::getEnvConfig('diffusion.render-time-limit');
+ if ($time_limit) {
+ $time_start = microtime(true);
+ $counter = 0;
+ }
foreach ($display as $line) {
+ // We on;y check timer once in a while, this saves some time being spent
+ // on getting value of the clock.
+ if ($time_limit) {
+ if ($counter % 10) {
+ if (microtime(true) - $time_start > $time_limit) {
+ $rows[] = phutil_tag(
+ 'tr',
+ array(),
+ array(
+ phutil_tag('th', array(), ''),
+ phutil_tag(
+ 'td', array('align' => 'center'),
+ phutil_tag(
+ 'i',
+ array(),
+ 'File has been trunkated on display'))));
+ break;
+ }
+ }
+ $counter++;
+ }
$line_href = $drequest->generateURI(
array(

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 5:55 PM (7 h, 38 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6940611
Default Alt Text
D8040.diff (2 KB)

Event Timeline