Fix linting errors
This commit is contained in:
parent
2eebd7aed6
commit
6992be6f58
@ -175,7 +175,9 @@ func (s *SocketIoServer) onMessage(c *gosocketio.Channel, req map[string]json.Ra
|
|||||||
t := time.Now()
|
t := time.Now()
|
||||||
params := req["params"]
|
params := req["params"]
|
||||||
s.metrics.SocketIOPendingRequests.With((common.Labels{"method": method})).Inc()
|
s.metrics.SocketIOPendingRequests.With((common.Labels{"method": method})).Inc()
|
||||||
defer s.metrics.SocketIOReqDuration.With(common.Labels{"method": method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds
|
defer func() {
|
||||||
|
s.metrics.SocketIOReqDuration.With(common.Labels{"method": method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds
|
||||||
|
}()
|
||||||
f, ok := onMessageHandlers[method]
|
f, ok := onMessageHandlers[method]
|
||||||
if ok {
|
if ok {
|
||||||
rv, err = f(s, params)
|
rv, err = f(s, params)
|
||||||
|
|||||||
@ -122,12 +122,12 @@ func getIP(r *http.Request) string {
|
|||||||
// ServeHTTP sets up handler of websocket channel
|
// ServeHTTP sets up handler of websocket channel
|
||||||
func (s *WebsocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s *WebsocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "GET" {
|
if r.Method != "GET" {
|
||||||
http.Error(w, upgradeFailed+ErrorMethodNotAllowed.Error(), 503)
|
http.Error(w, upgradeFailed+ErrorMethodNotAllowed.Error(), http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conn, err := s.upgrader.Upgrade(w, r, nil)
|
conn, err := s.upgrader.Upgrade(w, r, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, upgradeFailed+err.Error(), 503)
|
http.Error(w, upgradeFailed+err.Error(), http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c := &websocketChannel{
|
c := &websocketChannel{
|
||||||
@ -456,7 +456,9 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *WsReq) {
|
|||||||
}()
|
}()
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
s.metrics.WebsocketPendingRequests.With((common.Labels{"method": req.Method})).Inc()
|
s.metrics.WebsocketPendingRequests.With((common.Labels{"method": req.Method})).Inc()
|
||||||
defer s.metrics.WebsocketReqDuration.With(common.Labels{"method": req.Method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds
|
defer func() {
|
||||||
|
s.metrics.WebsocketReqDuration.With(common.Labels{"method": req.Method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds
|
||||||
|
}()
|
||||||
f, ok := requestHandlers[req.Method]
|
f, ok := requestHandlers[req.Method]
|
||||||
if ok {
|
if ok {
|
||||||
data, err = f(s, c, req)
|
data, err = f(s, c, req)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user