Skip to content

Commit

Permalink
[CHANGED] MaxPubAcksInFlight to MaxPubAcksInflight
Browse files Browse the repository at this point in the history
The introduced option setter had a case that did not match the
option it is setting and the similar Subscription's option
MaxInflight

Related to PR #88
  • Loading branch information
kozlovic committed Jul 15, 2016
1 parent c3ced71 commit d524023
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
11 changes: 2 additions & 9 deletions examples/stan-bench.go
Expand Up @@ -102,16 +102,9 @@ func main() {
}
}

func setMaxPubAcksInflight(val int) stan.Option {
return func(o *stan.Options) error {
o.MaxPubAcksInflight = val
return nil
}
}

func runPublisher(startwg, donewg *sync.WaitGroup, opts nats.Options, numMsgs int, msgSize int, async bool, pubID string, maxPubAcksInFlight int) {
func runPublisher(startwg, donewg *sync.WaitGroup, opts nats.Options, numMsgs int, msgSize int, async bool, pubID string, maxPubAcksInflight int) {

snc, err := stan.Connect("test-cluster", pubID, setMaxPubAcksInflight(maxPubAcksInFlight))
snc, err := stan.Connect("test-cluster", pubID, stan.MaxPubAcksInflight(maxPubAcksInflight))
if err != nil {
log.Fatalf("Publisher %s can't connect: %v\n", pubID, err)
}
Expand Down
4 changes: 2 additions & 2 deletions stan.go
Expand Up @@ -114,9 +114,9 @@ func PubAckWait(t time.Duration) Option {
}
}

// MaxPubAcksInFlight is an Option to set the maximum number of published
// MaxPubAcksInflight is an Option to set the maximum number of published
// messages without outstanding ACKs from the server.
func MaxPubAcksInFlight(max int) Option {
func MaxPubAcksInflight(max int) Option {
return func(o *Options) error {
o.MaxPubAcksInflight = max
return nil
Expand Down
8 changes: 4 additions & 4 deletions stan_test.go
Expand Up @@ -1091,7 +1091,7 @@ func TestRedelivery(t *testing.T) {
}
}

func TestRedeliveryHonorMaxInFlight(t *testing.T) {
func TestRedeliveryHonorMaxInflight(t *testing.T) {
// Run a NATS Streaming server
s := RunServer(clusterName)
defer s.Shutdown()
Expand Down Expand Up @@ -1889,7 +1889,7 @@ func TestNatsConn(t *testing.T) {
}
}

func TestMaxPubAcksInFlight(t *testing.T) {
func TestMaxPubAcksInflight(t *testing.T) {
s := RunServer(clusterName)
defer s.Shutdown()

Expand All @@ -1900,7 +1900,7 @@ func TestMaxPubAcksInFlight(t *testing.T) {
defer nc.Close()

sc, err := Connect(clusterName, clientName,
MaxPubAcksInFlight(1),
MaxPubAcksInflight(1),
PubAckWait(time.Second),
NatsConn(nc))
if err != nil {
Expand All @@ -1914,7 +1914,7 @@ func TestMaxPubAcksInFlight(t *testing.T) {

msg := []byte("hello")

// Send more than one message, if MaxPubAcksInFlight() works, one
// Send more than one message, if MaxPubAcksInflight() works, one
// of the publish call should block for up to PubAckWait.
start := time.Now()
for i := 0; i < 2; i++ {
Expand Down

0 comments on commit d524023

Please sign in to comment.