Skip to content

Instantly share code, notes, and snippets.

@dng-dev
Created July 26, 2016 19:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dng-dev/457e7306e06f528c175e7183de9b5889 to your computer and use it in GitHub Desktop.
Save dng-dev/457e7306e06f528c175e7183de9b5889 to your computer and use it in GitHub Desktop.
implementation for fastcgi_finish_request in Magento
diff --git a/app/code/core/Mage/Core/Controller/Varien/Front.php b/app/code/core/Mage/Core/Controller/Varien/Front.php
index 75d0e17..890ba9d 100755
--- a/app/code/core/Mage/Core/Controller/Varien/Front.php
+++ b/app/code/core/Mage/Core/Controller/Varien/Front.php
@@ -182,6 +182,12 @@ class Mage_Core_Controller_Varien_Front extends Varien_Object
Mage::dispatchEvent('controller_front_send_response_before', array('front'=>$this));
Varien_Profiler::start('mage::app::dispatch::send_response');
$this->getResponse()->sendResponse();
+ //This function flushes all response data to the client and finishes the request.
+ // This allows for time consuming tasks to be performed without leaving the connection
+ // to the client open.
+ if(php_sapi_name() == 'fpm-fcgi' && true === function_exists('fastcgi_finish_request')){
+ fastcgi_finish_request();
+ }
Varien_Profiler::stop('mage::app::dispatch::send_response');
Mage::dispatchEvent('controller_front_send_response_after', array('front'=>$this));
return $this;
fastcgi_finish_request.patch (END)
@dng-dev
Copy link
Author

dng-dev commented Jul 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment