summaryrefslogtreecommitdiff
path: root/src/rhctl/playout_server.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-18 21:58:07 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-18 21:58:07 (GMT)
commit7b6cc0eb1d6d8e2a7fa22ade10e79eb06f0d6bbf (patch)
tree8ca432868a62409237eae4493291bc91c337c0d3 /src/rhctl/playout_server.go
parent0174146eb468888ac27bc5ae78b7a20dcd06f565 (diff)
fetch state from switch and server if they are stale/missing
Diffstat (limited to 'src/rhctl/playout_server.go')
-rw-r--r--src/rhctl/playout_server.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rhctl/playout_server.go b/src/rhctl/playout_server.go
index ca00611..30577b8 100644
--- a/src/rhctl/playout_server.go
+++ b/src/rhctl/playout_server.go
@@ -48,6 +48,7 @@ type ServerState struct {
Name string
Health ServerHealth
Channel string
+ Changed time.Time
}
type PlayoutServer struct {
@@ -73,6 +74,7 @@ func (srv *PlayoutServer) handleControl(data string) {
return
}
srv.state.Channel = data[8:]
+ srv.state.Changed = time.Now()
srv.StateChanges <- srv.state
return
}
@@ -89,6 +91,7 @@ func (srv *PlayoutServer) handleHeartbeat(data string) {
old := srv.state.Health
srv.state.Health = ServerAlive
+ srv.state.Changed = time.Now()
if old != srv.state.Health {
srv.StateChanges <- srv.state
rhl.Printf("Server(%s): is back from the dead!", srv.name)
@@ -102,6 +105,7 @@ func (srv *PlayoutServer) handleHBTimeout() {
rhl.Printf("Server(%s): heartbeat timed-out", srv.name)
srv.hbcnt = 0
srv.state.Health = ServerDead
+ srv.state.Changed = time.Now()
srv.StateChanges <- srv.state
}