Commit 3c7b3205 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Reduce writer timeout, increase amount of buffering.

If the writer gets congested, the whole group might be delayed.  Better
to drop the slow client in that case.
parent fe83f619
...@@ -746,7 +746,7 @@ func StartClient(conn *websocket.Conn) (err error) { ...@@ -746,7 +746,7 @@ func StartClient(conn *websocket.Conn) (err error) {
defer close(c.done) defer close(c.done)
c.writeCh = make(chan interface{}, 25) c.writeCh = make(chan interface{}, 100)
c.writerDone = make(chan struct{}) c.writerDone = make(chan struct{})
go clientWriter(conn, c.writeCh, c.writerDone) go clientWriter(conn, c.writeCh, c.writerDone)
defer func() { defer func() {
...@@ -1497,7 +1497,8 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc ...@@ -1497,7 +1497,8 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc
break break
} }
err := conn.SetWriteDeadline( err := conn.SetWriteDeadline(
time.Now().Add(2 * time.Second)) time.Now().Add(500 * time.Millisecond),
)
if err != nil { if err != nil {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment