Skip to content

Commit

Permalink
Merge pull request #980 from ripienaar/conn_open_default
Browse files Browse the repository at this point in the history
Default to open not all for connections
  • Loading branch information
ripienaar authored Jan 30, 2024
2 parents ed7b2ee + 58cf3e1 commit 4eed487
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions cli/server_report_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,13 @@ func (c *SrvReportCmd) getConnz(limit int, nc *nats.Conn) (connzList, error) {
var err error
env := map[string]any{}

if c.waitFor == 0 {
c.waitFor, err = currentActiveServers(nc)
if err != nil {
return nil, err
}
}

switch {
case c.filterReason != "" && c.filterExpression != "":
return nil, fmt.Errorf("cannot filter for closed reason and use a filter expression at the same time")
Expand Down Expand Up @@ -796,12 +803,12 @@ func (c *SrvReportCmd) getConnz(limit int, nc *nats.Conn) (connzList, error) {

state := server.ConnOpen
switch c.stateFilter {
case "open":
state = server.ConnOpen
case "all":
state = server.ConnAll
case "closed":
state = server.ConnClosed
default:
state = server.ConnAll
state = server.ConnOpen
}

req := &server.ConnzEventOptions{
Expand Down
6 changes: 3 additions & 3 deletions cli/server_request_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,12 @@ func (c *SrvRequestCmd) conns(_ *fisk.ParseContext) error {
}

switch c.stateFilter {
case "open":
opts.State = server.ConnOpen
case "all":
opts.State = server.ConnAll
case "closed":
opts.State = server.ConnClosed
default:
opts.State = server.ConnAll
opts.State = server.ConnOpen
}

nc, _, err := prepareHelper("", natsOpts()...)
Expand Down

0 comments on commit 4eed487

Please sign in to comment.