aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-10-14 14:37:50 +0200
committerGravatar GitHub <noreply@github.com> 2018-10-14 14:37:50 +0200
commit5b030dcc6ff1393e29ecc6e5c76f129c7ad6c914 (patch)
tree6f067da3d9cc3c9691053ebae6c25750c79a4eb3 /app/Controllers
parent1f3953715892a3944895f80c4dce559b7e4e86d4 (diff)
Ensure fast flush of HTTP headers and HTML head (#2045)
* Ensure fast flush of HTTP headers and HTML head The fast flush optimisation done in https://github.com/FreshRSS/FreshRSS/pull/1133 does not seem to work anymore (need to check if it is related to a PHP version). Work-around when PHP flush() is not working Can be tested by adding a `sleep(5);` after: https://github.com/FreshRSS/FreshRSS/blob/ee902ee7c4370421802768c3105ba269a4f97b16/app/layout/layout.phtml#L27 Follow-up of the performance checks of https://github.com/FreshRSS/FreshRSS/pull/2040 * output_buffering in .user.ini for PHP CGI / FPM * Reuse .user.ini for Docker PHP config * Longer flush Flush a bit later, to be compatible with the default value of 4096 for PHP output_buffering, and thus avoid the need of tuning the value.
Diffstat (limited to 'app/Controllers')
-rwxr-xr-xapp/Controllers/indexController.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 8b905c881..fa914ef87 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -32,7 +32,16 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Error::error(404);
}
- $this->view->callbackBeforeContent = function ($view) {
+ $this->view->categories = FreshRSS_Context::$categories;
+
+ $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
+ $title = FreshRSS_Context::$name;
+ if (FreshRSS_Context::$get_unread > 0) {
+ $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title;
+ }
+ Minz_View::prependTitle($title . ' · ');
+
+ $this->view->callbackBeforeFeeds = function ($view) {
try {
$tagDAO = FreshRSS_Factory::createTagDao();
$view->tags = $tagDAO->listTags(true);
@@ -40,7 +49,13 @@ class FreshRSS_index_Controller extends Minz_ActionController {
foreach ($view->tags as $tag) {
$view->nbUnreadTags += $tag->nbUnread();
}
+ } catch (Exception $e) {
+ Minz_Log::notice($e->getMessage());
+ }
+ };
+ $this->view->callbackBeforeEntries = function ($view) {
+ try {
FreshRSS_Context::$number++; //+1 for pagination
$entries = FreshRSS_index_Controller::listEntriesByContext();
FreshRSS_Context::$number--;
@@ -67,15 +82,6 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Log::notice($e->getMessage());
Minz_Error::error(404);
}
-
- $view->categories = FreshRSS_Context::$categories;
-
- $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
- $title = FreshRSS_Context::$name;
- if (FreshRSS_Context::$get_unread > 0) {
- $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title;
- }
- Minz_View::prependTitle($title . ' · ');
};
}