public function dispatchLoopShutdown()
 {
     if (Application_Model_RabbitMq::$doPush) {
         $md = array('schedule' => Application_Model_Schedule::getSchedule());
         Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
         if (!isset($_SERVER['AIRTIME_SRV'])) {
             Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule");
         }
     }
     if (memory_get_peak_usage() > 30 * pow(2, 20)) {
         Logging::debug("Peak memory usage: " . memory_get_peak_usage() / 1000000 . " MB while accessing URI " . $_SERVER['REQUEST_URI']);
         Logging::debug("Should try to keep memory footprint under 25 MB");
     }
 }
Beispiel #2
0
 public function cancelShow($p_id)
 {
     $this->con->beginTransaction();
     try {
         $instance = CcShowInstancesQuery::create()->findPK($p_id);
         if (!$instance->getDbRecord()) {
             $items = CcScheduleQuery::create()->filterByDbInstanceId($p_id)->filterByDbEnds($this->nowDT, Criteria::GREATER_THAN)->find($this->con);
             if (count($items) > 0) {
                 $remove = array();
                 $ts = $this->nowDT->format('U');
                 for ($i = 0; $i < count($items); $i++) {
                     $remove[$i]["instance"] = $p_id;
                     $remove[$i]["timestamp"] = $ts;
                     $remove[$i]["id"] = $items[$i]->getDbId();
                 }
                 $this->removeItems($remove, false);
             }
         } else {
             $rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
             $rebroadcasts->delete($this->con);
         }
         $instance->setDbEnds($this->nowDT);
         $instance->save($this->con);
         $this->con->commit();
         if ($instance->getDbRecord()) {
             Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
         }
     } catch (Exception $e) {
         $this->con->rollback();
         throw $e;
     }
 }