forked from tangled.org/core
this repo has no description

knotserver: reduce logging noise from event stream

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li c16a1338 f2b6ba26

verified
Changed files
+6 -6
knotserver
+6 -6
knotserver/events.go
··· 16 16 17 17 func (h *Handle) Events(w http.ResponseWriter, r *http.Request) { 18 18 l := h.l.With("handler", "OpLog") 19 - l.Info("received new connection") 19 + l.Debug("received new connection") 20 20 21 21 conn, err := upgrader.Upgrade(w, r, nil) 22 22 if err != nil { ··· 25 25 return 26 26 } 27 27 defer conn.Close() 28 - l.Info("upgraded http to wss") 28 + l.Debug("upgraded http to wss") 29 29 30 30 ch := h.n.Subscribe() 31 31 defer h.n.Unsubscribe(ch) ··· 45 45 cursor := r.URL.Query().Get("cursor") 46 46 47 47 // complete backfill first before going to live data 48 - l.Info("going through backfill", "cursor", cursor) 48 + l.Debug("going through backfill", "cursor", cursor) 49 49 if err := h.streamOps(conn, &cursor); err != nil { 50 50 l.Error("failed to backfill", "err", err) 51 51 return ··· 55 55 // wait for new data or timeout 56 56 select { 57 57 case <-ctx.Done(): 58 - l.Info("stopping stream: client closed connection") 58 + l.Debug("stopping stream: client closed connection") 59 59 return 60 60 case <-ch: 61 61 // we have been notified of new data 62 - l.Info("going through live data", "cursor", cursor) 62 + l.Debug("going through live data", "cursor", cursor) 63 63 if err := h.streamOps(conn, &cursor); err != nil { 64 64 l.Error("failed to stream", "err", err) 65 65 return 66 66 } 67 67 case <-time.After(30 * time.Second): 68 68 // send a keep-alive 69 - l.Info("sent keepalive") 69 + l.Debug("sent keepalive") 70 70 if err = conn.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(time.Second)); err != nil { 71 71 l.Error("failed to write control", "err", err) 72 72 }