CC-4873: Airtime takes 7 seconds to load 32K (very small) from db

-we know what month will be the initial view for the user.
-Provide this data ahead of time via ajax request
This commit is contained in:
Martin Konecny 2013-01-24 12:52:24 -05:00
parent ef806b8357
commit 2f3a30b580
3 changed files with 32 additions and 28 deletions

View file

@ -9,6 +9,7 @@ class ScheduleController extends Zend_Controller_Action
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('event-feed', 'json')
->addActionContext('event-feed-preload', 'json')
->addActionContext('make-context-menu', 'json')
->addActionContext('add-show-dialog', 'json')
->addActionContext('add-show', 'json')
@ -88,30 +89,13 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
//End Show builder JS/CSS requirements
Application_Model_Schedule::createNewFormSections($this->view);
$user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$this->view->preloadShowForm = true;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$editable = true;
} else {
$editable = false;
}
$calendar_interval = Application_Model_Preference::GetCalendarTimeInterval();
if ($calendar_interval == "agendaDay") {
} else if ($calendar_interval == "agendaWeek") {
} else if ($calendar_interval == "month") {
}
list($start, $end) = Application_Model_Show::getStartEndCurrentMonthView();
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
$this->view->headScript()->appendScript(
"var calendarPref = {};\n".
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
@ -120,7 +104,7 @@ class ScheduleController extends Zend_Controller_Action
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
"var calendarEvents = ".json_encode($events).";"
"var calendarEvents = null;"
);
}
@ -133,16 +117,29 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$editable = true;
} else {
$editable = false;
}
$editable = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
$this->view->events = $events;
}
public function eventFeedPreloadAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$editable = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$calendar_interval = Application_Model_Preference::GetCalendarTimeInterval();
if ($calendar_interval == "agendaDay") {
} else if ($calendar_interval == "agendaWeek") {
} else if ($calendar_interval == "month") {
}
list($start, $end) = Application_Model_Show::getStartEndCurrentMonthView();
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
$this->view->events = $events;
}
public function getCurrentShowAction()
{
$currentShow = Application_Model_Show::getCurrentShow();