diff --git a/cmd/circolog-tail/main.go b/cmd/circolog-tail/main.go index e0ecfd2..74a7a7c 100644 --- a/cmd/circolog-tail/main.go +++ b/cmd/circolog-tail/main.go @@ -149,7 +149,7 @@ func main() { select { case <-done: log.Println("Successfully close") - case <-time.After(1 * time.Second): + case <-time.After(5 * time.Second): log.Println("Forced close") } return diff --git a/cmd/circologd/http_log.go b/cmd/circologd/http_log.go index 712d15a..bdb63c8 100644 --- a/cmd/circologd/http_log.go +++ b/cmd/circologd/http_log.go @@ -153,6 +153,14 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc { hub.Unregister <- c conn.Close() }() + go func() { + for { + _, _, err := conn.ReadMessage() + if err != nil { + return + } + } + }() for { select { case message, ok := <-c.Messages: