···
func (h *Handle) Events(w http.ResponseWriter, r *http.Request) {
l := h.l.With("handler", "OpLog")
19
-
l.Info("received new connection")
19
+
l.Debug("received new connection")
conn, err := upgrader.Upgrade(w, r, nil)
···
28
-
l.Info("upgraded http to wss")
28
+
l.Debug("upgraded http to wss")
defer h.n.Unsubscribe(ch)
···
cursor := r.URL.Query().Get("cursor")
// complete backfill first before going to live data
48
-
l.Info("going through backfill", "cursor", cursor)
48
+
l.Debug("going through backfill", "cursor", cursor)
if err := h.streamOps(conn, &cursor); err != nil {
l.Error("failed to backfill", "err", err)
···
// wait for new data or timeout
58
-
l.Info("stopping stream: client closed connection")
58
+
l.Debug("stopping stream: client closed connection")
// 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)
if err := h.streamOps(conn, &cursor); err != nil {
l.Error("failed to stream", "err", err)
case <-time.After(30 * time.Second):
69
-
l.Info("sent keepalive")
69
+
l.Debug("sent keepalive")
if err = conn.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(time.Second)); err != nil {
l.Error("failed to write control", "err", err)