Load broadcast state on startup

This commit is contained in:
Saxon Nelson-Milton 2023-02-16 10:17:11 +10:30
parent b68da55793
commit f9cfbda44f
1 changed files with 9 additions and 1 deletions

View File

@ -304,7 +304,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
switch broadcast.status {
case statusActive, statusPlay, statusCreate:
m.log.Info("updating configuration for mac","mac",broadcast.mac)
m.log.Info("updating configuration for mac", "mac", broadcast.mac)
signal, ok := m.slateExitSignals[broadcast.mac]
if ok {
close(signal)
@ -375,6 +375,14 @@ func main() {
if err != nil {
log.Fatal("could not create new broadcast manager", "error", err)
}
// Try to load any previous state. There may be a previous state if the
// watchdog did a process restart.
err = m.load()
if err != nil {
log.Warning("could not load previous state", "error", err)
}
http.HandleFunc("/recv", m.recv)
http.HandleFunc("/control", m.control)