fix skylabify output

This commit is contained in:
saji 2023-06-30 22:08:06 -05:00
parent 699cfb5e3d
commit 96796ad794
3 changed files with 4 additions and 2 deletions

View file

@ -89,7 +89,7 @@ func serve(cCtx *cli.Context) error {
slog.SetDefault(logger) slog.SetDefault(logger)
broker := gotelem.NewBroker(3, logger.WithGroup("broker")) broker := gotelem.NewBroker(20, logger.WithGroup("broker"))
// open database // open database
dbPath := "file::memory:?cache=shared" dbPath := "file::memory:?cache=shared"

View file

@ -118,12 +118,13 @@ func run(ctx *cli.Context) (err error) {
if errors.As(err, &idErr) { if errors.As(err, &idErr) {
// unknown id // unknown id
slog.Info("unknown id", "err", err) slog.Info("unknown id", "err", err)
continue
} else if err != nil { } else if err != nil {
return err return err
} }
// format and print out the JSON. // format and print out the JSON.
out, _ := json.Marshal(cd) out, _ := json.Marshal(&cd)
fmt.Println(string(out)) fmt.Println(string(out))
} }

View file

@ -123,6 +123,7 @@ func apiV1PacketSubscribe(broker *Broker, db *db.TelemDb) http.HandlerFunc {
defer broker.Unsubscribe(conn_id) defer broker.Unsubscribe(conn_id)
// attempt to upgrade. // attempt to upgrade.
c, err := websocket.Accept(w, r, nil) c, err := websocket.Accept(w, r, nil)
c.Ping(r.Context())
if err != nil { if err != nil {
// TODO: is this the correct option? // TODO: is this the correct option?
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)