1
0
Fork 0
forked from boyska/circolog

Hub resists to Client failures

This commit is contained in:
boyska 2018-08-23 01:14:08 +02:00
parent 66f32d1c05
commit 97743eaad5

14
hub.go
View file

@ -48,7 +48,12 @@ func (h *Hub) Run() {
}
h.circbuf.Do(func(x interface{}) {
if x != nil {
cl.Messages <- x.(format.LogParts)
select { // send without blocking
case cl.Messages <- x.(format.LogParts):
break
default:
break
}
}
})
if cl.Nofollow {
@ -65,7 +70,12 @@ func (h *Hub) Run() {
h.circbuf.Value = msg
h.circbuf = h.circbuf.Next()
for client := range h.clients {
client.Messages <- msg
select { // send without blocking
case client.Messages <- msg:
break
default:
break
}
}
}
}