Merge branch '2.3.x' of dev.sourcefabric.org:airtime into 2.3.x
This commit is contained in:
commit
d0a4141ae4
2 changed files with 14 additions and 4 deletions
|
@ -273,7 +273,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetEnableReplayGain($values["enableReplayGain"]);
|
Application_Model_Preference::SetEnableReplayGain($values["enableReplayGain"]);
|
||||||
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
|
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
|
||||||
$md = array('schedule' => Application_Model_Schedule::getSchedule());
|
$md = array('schedule' => Application_Model_Schedule::getSchedule());
|
||||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
|
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ class PypoFetch(Thread):
|
||||||
self.set_bootstrap_variables()
|
self.set_bootstrap_variables()
|
||||||
#get the most up to date schedule, which will #initiate the process
|
#get the most up to date schedule, which will #initiate the process
|
||||||
#of making sure Liquidsoap is playing the schedule
|
#of making sure Liquidsoap is playing the schedule
|
||||||
self.manual_schedule_fetch()
|
self.persistent_manual_schedule_fetch(max_attempts=5)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(str(e))
|
self.logger.error(str(e))
|
||||||
|
|
||||||
|
@ -488,10 +488,20 @@ class PypoFetch(Thread):
|
||||||
self.process_schedule(self.schedule_data)
|
self.process_schedule(self.schedule_data)
|
||||||
return success
|
return success
|
||||||
|
|
||||||
|
def persistent_manual_schedule_fetch(self, max_attempts=1):
|
||||||
|
success = False
|
||||||
|
num_attempts = 0
|
||||||
|
while not success and num_attempts < max_attempts:
|
||||||
|
success = self.manual_schedule_fetch()
|
||||||
|
num_attempts += 1
|
||||||
|
|
||||||
|
return success
|
||||||
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
# Bootstrap: since we are just starting up, we need to grab the
|
# Bootstrap: since we are just starting up, we need to grab the
|
||||||
# most recent schedule. After that we can just wait for updates.
|
# most recent schedule. After that we can just wait for updates.
|
||||||
success = self.manual_schedule_fetch()
|
success = self.persistent_manual_schedule_fetch(max_attempts=5)
|
||||||
if success:
|
if success:
|
||||||
self.logger.info("Bootstrap schedule received: %s", self.schedule_data)
|
self.logger.info("Bootstrap schedule received: %s", self.schedule_data)
|
||||||
self.set_bootstrap_variables()
|
self.set_bootstrap_variables()
|
||||||
|
@ -519,7 +529,7 @@ class PypoFetch(Thread):
|
||||||
self.handle_message(message)
|
self.handle_message(message)
|
||||||
except Empty, e:
|
except Empty, e:
|
||||||
self.logger.info("Queue timeout. Fetching schedule manually")
|
self.logger.info("Queue timeout. Fetching schedule manually")
|
||||||
self.manual_schedule_fetch()
|
self.persistent_manual_schedule_fetch(max_attempts=5)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
import traceback
|
import traceback
|
||||||
top = traceback.format_exc()
|
top = traceback.format_exc()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue