forked from boyska/circolog
Hub resists to Client failures
This commit is contained in:
parent
66f32d1c05
commit
97743eaad5
1 changed files with 12 additions and 2 deletions
14
hub.go
14
hub.go
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue