From 96796ad794ee2e4f6211eec37a3fd8180c8a921b Mon Sep 17 00:00:00 2001 From: saji <9110284+kschamplin@users.noreply.github.com> Date: Fri, 30 Jun 2023 22:08:06 -0500 Subject: [PATCH] fix skylabify output --- cmd/gotelem/cli/server.go | 2 +- cmd/skylabify/skylabify.go | 3 ++- http.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/gotelem/cli/server.go b/cmd/gotelem/cli/server.go index fd7eba2..de2cd1e 100644 --- a/cmd/gotelem/cli/server.go +++ b/cmd/gotelem/cli/server.go @@ -89,7 +89,7 @@ func serve(cCtx *cli.Context) error { slog.SetDefault(logger) - broker := gotelem.NewBroker(3, logger.WithGroup("broker")) + broker := gotelem.NewBroker(20, logger.WithGroup("broker")) // open database dbPath := "file::memory:?cache=shared" diff --git a/cmd/skylabify/skylabify.go b/cmd/skylabify/skylabify.go index bc6fb17..3e0a9c2 100644 --- a/cmd/skylabify/skylabify.go +++ b/cmd/skylabify/skylabify.go @@ -118,12 +118,13 @@ func run(ctx *cli.Context) (err error) { if errors.As(err, &idErr) { // unknown id slog.Info("unknown id", "err", err) + continue } else if err != nil { return err } // format and print out the JSON. - out, _ := json.Marshal(cd) + out, _ := json.Marshal(&cd) fmt.Println(string(out)) } diff --git a/http.go b/http.go index fd9ac7a..281b13c 100644 --- a/http.go +++ b/http.go @@ -123,6 +123,7 @@ func apiV1PacketSubscribe(broker *Broker, db *db.TelemDb) http.HandlerFunc { defer broker.Unsubscribe(conn_id) // attempt to upgrade. c, err := websocket.Accept(w, r, nil) + c.Ping(r.Context()) if err != nil { // TODO: is this the correct option? w.WriteHeader(http.StatusInternalServerError)