Skip to content

Commit

Permalink
fix: default condition of consumer replica
Browse files Browse the repository at this point in the history
  • Loading branch information
komalreddy3 committed Jun 18, 2024
1 parent 69f7218 commit 38444d5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pubSub/pubSub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,15 @@ export class PubSubServiceImpl implements PubSubService {
let updatesDetected: boolean = false
try {
const info: ConsumerInfo | null = await this.jsm.consumers.info(streamName, consumerName)
const streamInfo: StreamInfo | null = await this.jsm.streams.info(streamName)
if (streamInfo && info){
if(info.config.num_replicas==0) {
info.config.num_replicas = streamInfo.config.num_replicas //By default, when the value is set to zero, consumers inherit the number of replicas from the stream.
}
}
if (info) {
if (consumerConfiguration.ack_wait > 0 && info.config.ack_wait != consumerConfiguration.ack_wait) {
info.config.ack_wait = consumerConfiguration.ack_wait
updatesDetected = true
}
const streamInfo: StreamInfo | null = await this.jsm.streams.info(streamName)
if(consumerConfiguration.num_replicas==0) {
info.config.num_replicas = streamInfo.config.num_replicas //By default, when the value is set to zero, consumers inherit the number of replicas from the stream.
}
if (consumerConfiguration.num_replicas > 0 && info.config.num_replicas!= consumerConfiguration.num_replicas){
if (consumerConfiguration.num_replicas>1 && this.nc.info.cluster==undefined) {
this.logger.warn("replicas > 1 is not possible in non clustered mode")
Expand Down

0 comments on commit 38444d5

Please sign in to comment.