Skip to content

Commit

Permalink
fix: disconnect the EventEmitter (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinkrustev authored Mar 15, 2024
1 parent 0eee6bb commit d1cdab6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/kafka/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class Consumer extends EventEmitter {
})

this._consumer.on('disconnected', (metrics) => {
connectedClients.delete(this._consumer)
connectedClients.delete(this)
Logger.isDebugEnabled && logger.debug(`Consumer::onDisconnected - ${JSON.stringify(metrics)}`)
super.emit('disconnected', metrics)
})
Expand All @@ -360,7 +360,7 @@ class Consumer extends EventEmitter {
Logger.isSillyEnabled && logger.silly('Consumer::connect() - end')
return reject(error)
}
connectedClients.add(this._consumer)
connectedClients.add(this)
Logger.isSillyEnabled && logger.silly('Consumer::connect() - metadata:')
Logger.isSillyEnabled && logger.silly(metadata)
})
Expand Down
4 changes: 2 additions & 2 deletions src/kafka/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Producer extends EventEmitter {
})

this._producer.on('disconnected', (metrics) => {
connectedClients.delete(this._producer)
connectedClients.delete(this)
Logger.isDebugEnabled && logger.debug(`Producer::onDisconnected - ${JSON.stringify(metrics)}`)
super.emit('disconnected', metrics)
})
Expand All @@ -320,7 +320,7 @@ class Producer extends EventEmitter {
Logger.isSillyEnabled && logger.silly('Producer::connect() - end')
return reject(error)
}
connectedClients.add(this._producer)
connectedClients.add(this)
Logger.isSillyEnabled && logger.silly('Producer::connect() - metadata:')
Logger.isSillyEnabled && logger.silly(metadata)
resolve(true)
Expand Down

0 comments on commit d1cdab6

Please sign in to comment.