Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Apr 23, 2024
1 parent 7dab7b8 commit f6623a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions server/consumer.go
Expand Up @@ -460,13 +460,13 @@ func setConsumerConfigDefaults(config *ConsumerConfig, streamCfg *StreamConfig,
}
if config.MaxAckPending == 0 {
if pedantic && streamCfg.ConsumerLimits.MaxAckPending > 0 {
return NewJSPedanticError(errors.New("max_ack_pending must be set"))
return NewJSPedanticError(errors.New("max_ack_pending must be set if it's configured in stream limits"))
}
config.MaxAckPending = streamCfg.ConsumerLimits.MaxAckPending
}
if config.InactiveThreshold == 0 {
if streamCfg.ConsumerLimits.InactiveThreshold > 0 && pedantic {
return NewJSPedanticError(errors.New("inactive_threshold must be set if limits are set"))
if pedantic && streamCfg.ConsumerLimits.InactiveThreshold > 0 {
return NewJSPedanticError(errors.New("inactive_threshold must be set if it's configured in stream limits"))
}
config.InactiveThreshold = streamCfg.ConsumerLimits.InactiveThreshold
}
Expand All @@ -484,7 +484,7 @@ func setConsumerConfigDefaults(config *ConsumerConfig, streamCfg *StreamConfig,
// if applicable set max request batch size
if config.DeliverSubject == _EMPTY_ && config.MaxRequestBatch == 0 && lim.MaxRequestBatch > 0 {
if pedantic {
return NewJSPedanticError(errors.New("max_request_batch must be set if limits are set"))
return NewJSPedanticError(errors.New("max_request_batch must be set if it's JetStream limits are set"))
}
config.MaxRequestBatch = lim.MaxRequestBatch
}
Expand Down
4 changes: 2 additions & 2 deletions server/stream.go
Expand Up @@ -1335,7 +1335,7 @@ func (s *Server) checkStreamCfg(config *StreamConfig, acc *Account, pedantic boo
// Determine if we are inheriting direct gets.
if exists, ocfg := getStream(cfg.Mirror.Name); exists {
if pedantic && cfg.MirrorDirect != ocfg.AllowDirect {
return StreamConfig{}, NewJSPedanticError(fmt.Errorf("pedantic mode: origin stream has direct get set, mirror has it disabled"))
return StreamConfig{}, NewJSPedanticError(fmt.Errorf("origin stream has direct get set, mirror has it disabled"))
}
cfg.MirrorDirect = ocfg.AllowDirect
} else if js := s.getJetStream(); js != nil && js.isClustered() {
Expand All @@ -1346,7 +1346,7 @@ func (s *Server) checkStreamCfg(config *StreamConfig, acc *Account, pedantic boo
if sa := as[cfg.Mirror.Name]; sa != nil {
if pedantic && cfg.MirrorDirect != sa.Config.AllowDirect {
js.mu.RUnlock()
return StreamConfig{}, NewJSPedanticError(fmt.Errorf("pedantic mode: origin stream has direct get set, mirror has it disabled"))
return StreamConfig{}, NewJSPedanticError(fmt.Errorf("origin stream has direct get set, mirror has it disabled"))
}
cfg.MirrorDirect = sa.Config.AllowDirect
}
Expand Down

0 comments on commit f6623a7

Please sign in to comment.