an app.bsky.* indexer

only attach firehose cursor if there is one

Changed files
+3 -1
cmd
monarch
+3 -1
cmd/monarch/firehose.go
···
func NewFirehoseConnection(ctx context.Context, cctx *cli.Context, cursorSvc *CursorService) (*websocket.Conn, error) {
url := fmt.Sprintf("wss://%s/xrpc/com.atproto.sync.subscribeRepos", cctx.String("relay-host"))
curs, err := cursorSvc.GetFirehoseCursor()
-
if err == nil { // reversed
url += fmt.Sprintf("?cursor=%d", curs)
}
···
func NewFirehoseConnection(ctx context.Context, cctx *cli.Context, cursorSvc *CursorService) (*websocket.Conn, error) {
url := fmt.Sprintf("wss://%s/xrpc/com.atproto.sync.subscribeRepos", cctx.String("relay-host"))
curs, err := cursorSvc.GetFirehoseCursor()
+
if err != nil {
+
slog.Error("error getting firehose cursor", "err", err)
+
} else if curs > 0 {
url += fmt.Sprintf("?cursor=%d", curs)
}