0

It takes about 1.5s to show the result on Chrome (1.X seconds are TTFB) according to record of Chrome's network tool. My Magento is using redis for caches, and the caches are turned on. How come the controller taking so long time to response?

use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Controller\Result\RedirectFactory;

class GetHealthStatus extends \Magento\Framework\App\Action\Action
{
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

     /**
     * @var \Magento\Framework\Controller\Result\RedirectFactory
     */
    protected $resultRedirectFactory;

    /**
     * @param Context $context
     * @param PageFactory $resultPageFactory
     * @param \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        $this->resultRedirectFactory = $resultRedirectFactory;
        parent::__construct($context);
    }

    /**
     * Customer order history
     * return json
     * @return \Magento\Framework\View\Result\Page
     */
   public function execute()
    {
       $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
       $resultJsonFactory = $objectManager->get('\Magento\Framework\Controller\Result\JsonFactory'); 
       $result = ['status'=>'OK'];
       return $resultJsonFactory->create()->setData($result);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.