Refactored session_write_close() optimization and dashboard preloading
hack
This commit is contained in:
parent
3e255bfd37
commit
1734cc35c8
|
@ -100,6 +100,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$csrf_namespace->authtoken = sha1(uniqid(rand(),1));
|
$csrf_namespace->authtoken = sha1(uniqid(rand(),1));
|
||||||
$csrf_namespace->setExpirationSeconds(2*60*60);
|
$csrf_namespace->setExpirationSeconds(2*60*60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Here we are closing the session for writing because otherwise no requests
|
||||||
|
//in this session will be handled in parallel. This gives a major boost to the perceived performance
|
||||||
|
//of the application (page load times are more consistent, no lock contention).
|
||||||
|
session_write_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -405,7 +405,6 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function contentsFeedAction()
|
public function contentsFeedAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$params = $this->getRequest()->getParams();
|
$params = $this->getRequest()->getParams();
|
||||||
|
|
||||||
# terrible name for the method below. it does not only search files.
|
# terrible name for the method below. it does not only search files.
|
||||||
|
|
|
@ -123,7 +123,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function eventFeedAction()
|
public function eventFeedAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$service_user = new Application_Service_UserService();
|
$service_user = new Application_Service_UserService();
|
||||||
$currentUser = $service_user->getCurrentUser();
|
$currentUser = $service_user->getCurrentUser();
|
||||||
|
|
||||||
|
@ -145,7 +144,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$editable = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$editable = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
session_write_close();
|
|
||||||
|
|
||||||
$calendar_interval = Application_Model_Preference::GetCalendarTimeScale();
|
$calendar_interval = Application_Model_Preference::GetCalendarTimeScale();
|
||||||
if ($calendar_interval == "agendaDay") {
|
if ($calendar_interval == "agendaDay") {
|
||||||
|
@ -164,7 +162,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getCurrentShowAction()
|
public function getCurrentShowAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$currentShow = Application_Model_Show::getCurrentShow();
|
$currentShow = Application_Model_Show::getCurrentShow();
|
||||||
if (!empty($currentShow)) {
|
if (!empty($currentShow)) {
|
||||||
$this->view->si_id = $currentShow[0]["instance_id"];
|
$this->view->si_id = $currentShow[0]["instance_id"];
|
||||||
|
@ -304,9 +301,19 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This is a nasty hack to let us embed the the data the dashboard needs into the HTML response for each page.
|
||||||
|
* This was originally loaded AFTER page load by AJAX, which is needlessly slow. This should have been templated in.
|
||||||
|
*/
|
||||||
|
public static function printCurrentPlaylistForEmbedding()
|
||||||
|
{
|
||||||
|
$front = Zend_Controller_Front::getInstance();
|
||||||
|
$foo = new ScheduleController($front->getRequest(), $front->getResponse());
|
||||||
|
$foo->getCurrentPlaylistAction();
|
||||||
|
echo(json_encode($foo->view));
|
||||||
|
}
|
||||||
|
|
||||||
public function getCurrentPlaylistAction()
|
public function getCurrentPlaylistAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$range = Application_Model_Schedule::GetPlayOrderRangeOld();
|
$range = Application_Model_Schedule::GetPlayOrderRangeOld();
|
||||||
$show = Application_Model_Show::getCurrentShow();
|
$show = Application_Model_Show::getCurrentShow();
|
||||||
|
|
||||||
|
@ -715,7 +722,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function setTimeScaleAction()
|
public function setTimeScaleAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function checkBuilderFeedAction()
|
public function checkBuilderFeedAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$show_filter = intval($request->getParam("showFilter", 0));
|
$show_filter = intval($request->getParam("showFilter", 0));
|
||||||
$my_shows = intval($request->getParam("myShows", 0));
|
$my_shows = intval($request->getParam("myShows", 0));
|
||||||
|
@ -266,7 +265,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function builderFeedAction()
|
public function builderFeedAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
|
@ -37,7 +37,6 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function setLibraryDatatableAction()
|
public function setLibraryDatatableAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getLibraryDatatableAction()
|
public function getLibraryDatatableAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
|
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
|
||||||
if (!is_null($data)) {
|
if (!is_null($data)) {
|
||||||
$this->view->settings = $data;
|
$this->view->settings = $data;
|
||||||
|
@ -55,7 +53,6 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function setTimelineDatatableAction()
|
public function setTimelineDatatableAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
|
@ -64,7 +61,6 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getTimelineDatatableAction()
|
public function getTimelineDatatableAction()
|
||||||
{
|
{
|
||||||
session_write_close();
|
|
||||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||||
if (!is_null($data)) {
|
if (!is_null($data)) {
|
||||||
$this->view->settings = $data;
|
$this->view->settings = $data;
|
||||||
|
|
|
@ -19,23 +19,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
})(window,document,'script','dataLayer','GTM-55N6NH');</script>
|
})(window,document,'script','dataLayer','GTM-55N6NH');</script>
|
||||||
<!-- End Google Tag Manager -->
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
//Awful hack to speed up loading - Embed the schedule in the response so that the dashboard
|
|
||||||
//doesn't have to make a separate AJAX request to get this data.
|
|
||||||
var schedulePreLoaded = <?php
|
|
||||||
require_once("ScheduleController.php");
|
|
||||||
$front = Zend_Controller_Front::getInstance();
|
|
||||||
$foo = new ScheduleController($front->getRequest(), $front->getResponse());
|
|
||||||
$foo->getCurrentPlaylistAction();
|
|
||||||
echo(json_encode($foo->view));
|
|
||||||
?>;
|
|
||||||
parseItems(schedulePreLoaded.entries);
|
|
||||||
parseSourceStatus(schedulePreLoaded.source_status);
|
|
||||||
parseSwitchStatus(schedulePreLoaded.switch_status);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php echo $this->partial('partialviews/trialBox.phtml', array("is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
<?php echo $this->partial('partialviews/trialBox.phtml', array("is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||||
<div id="Panel">
|
<div id="Panel">
|
||||||
<?php echo $this->versionNotify();
|
<?php echo $this->versionNotify();
|
||||||
|
@ -46,6 +29,23 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var schedulePreLoaded = <?php
|
||||||
|
//Awful hack to speed up loading - Embed the schedule in the response so that the dashboard
|
||||||
|
//doesn't have to make a separate AJAX request to get this data.
|
||||||
|
require_once("ScheduleController.php");
|
||||||
|
ScheduleController::printCurrentPlaylistForEmbedding();
|
||||||
|
?>;
|
||||||
|
//The DOM elements that these calls depend on exist by this point:
|
||||||
|
parseItems(schedulePreLoaded.entries);
|
||||||
|
parseSourceStatus(schedulePreLoaded.source_status);
|
||||||
|
parseSwitchStatus(schedulePreLoaded.switch_status);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<div class="logo"></div>
|
<div class="logo"></div>
|
||||||
<div class="personal-block solo">
|
<div class="personal-block solo">
|
||||||
|
|
|
@ -360,11 +360,11 @@ function windowResize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function preloadEventFeed () {
|
function preloadEventFeed () {
|
||||||
var url = baseUrl+'Schedule/event-feed-preload';
|
|
||||||
var d = new Date();
|
|
||||||
createFullCalendar({calendarInit: calendarPref});
|
createFullCalendar({calendarInit: calendarPref});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
var url = baseUrl+'Schedule/event-feed-preload';
|
||||||
|
var d = new Date();
|
||||||
$.post(url, {format: "json", cachep: d.getTime()}, function(json){
|
$.post(url, {format: "json", cachep: d.getTime()}, function(json){
|
||||||
calendarEvents = json.events;
|
calendarEvents = json.events;
|
||||||
createFullCalendar({calendarInit: calendarPref});
|
createFullCalendar({calendarInit: calendarPref});
|
||||||
|
|
Loading…
Reference in New Issue