Skip to content

WS: High CPU usage #5

@maaft

Description

@maaft

I noticed high cpu usage on subscriptions after 30 seconds when no new data comes in. The reason is to be found here:

client/transport/wshandler.go

func (wh *WebsocketHandler) ReadJSON(v interface{}) error {
	ctx, cancel := context.WithTimeout(wh.ctx, wh.timeout)
	defer cancel()
	return wsjson.Read(ctx, wh.Conn, v)
}

When I use no timeout, cpu usage stays low:

func (wh *WebsocketHandler) ReadJSON(v interface{}) error {
	return wsjson.Read(wh.ctx, wh.Conn, v)
}

Not sure if this an issue per se as you can provide your own WebsocketHandler anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions