Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
- [#125](https://github.com/kobsio/kobs/pull/125): Fix missing `return` statement in ClickHouse panel.
- [#129](https://github.com/kobsio/kobs/pull/129): Fix handling of traces in the Jaeger plugin by using some function from the [jaegertracing/jaeger-ui](https://github.com/jaegertracing/jaeger-ui).
- [#134](https://github.com/kobsio/kobs/pull/134): Fix time in log buckets of the ClickHouse plugin.
- [#135](https://github.com/kobsio/kobs/pull/135): Fix read and write i/o timeouts for web terminal.

### Changed

Expand Down
14 changes: 3 additions & 11 deletions plugins/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ import (
const Route = "/resources"

var (
log = logrus.WithFields(logrus.Fields{"package": "resources"})

// Time allowed to write a message to the peer.
writeWait = 10 * time.Second
// Time allowed to read the next pong message from the peer.
pongWait = 30 * time.Second
// Send pings to peer with this period. Must be less than pongWait.
pingPeriod = (pongWait * 9) / 10
log = logrus.WithFields(logrus.Fields{"package": "resources"})
pingPeriod = 30 * time.Second
)

// Resources is the structure for the getResources api call. It contains the cluster, namespace and the json
Expand Down Expand Up @@ -349,8 +343,7 @@ func (router *Router) getTerminal(w http.ResponseWriter, r *http.Request) {
}
defer c.Close()

c.SetReadDeadline(time.Now().Add(pongWait))
c.SetPongHandler(func(string) error { c.SetReadDeadline(time.Now().Add(pongWait)); return nil })
c.SetPongHandler(func(string) error { return nil })

go func() {
ticker := time.NewTicker(pingPeriod)
Expand All @@ -359,7 +352,6 @@ func (router *Router) getTerminal(w http.ResponseWriter, r *http.Request) {
for {
select {
case <-ticker.C:
c.SetWriteDeadline(time.Now().Add(writeWait))
if err := c.WriteMessage(websocket.PingMessage, nil); err != nil {
return
}
Expand Down