Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kafka-node

Package Overview
Dependencies
Maintainers
3
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kafka-node - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

3

CHANGELOG.md
# kafka-node CHANGELOG
## 2016-10-24, Version 1.0.3
- Fix issue in [Consumer Group](https://github.com/SOHU-Co/kafka-node#consumergroup) where using the migrator with no previous HLC offsets will set initial offsets to 0 instead of the offsets provided in "fromOfset" feature [#493](https://github.com/SOHU-Co/kafka-node/pull/493)
## 2016-10-22, Version 1.0.2

@@ -4,0 +7,0 @@ - Fix issue in [Consumer Group](https://github.com/SOHU-Co/kafka-node#consumergroup) where using the migrator with no previous HLC offsets will set initial offsets to -1 [#490](https://github.com/SOHU-Co/kafka-node/pull/490)

8

lib/consumerGroupMigrator.js

@@ -148,3 +148,3 @@ 'use strict';

}
self.offsets = _.mapValues(results, topic => _.mapValues(topic, value => value === -1 ? 0 : value));
self.offsets = results;
callback(null);

@@ -155,5 +155,9 @@ });

ConsumerGroupMigrator.prototype.getOffset = function (tp, defaultOffset) {
return _.get(this.offsets, [tp.topic, tp.partition], defaultOffset);
const offset = _.get(this.offsets, [tp.topic, tp.partition], defaultOffset);
if (offset === -1) {
return defaultOffset;
}
return offset;
};
module.exports = ConsumerGroupMigrator;

@@ -12,3 +12,3 @@ {

"bugs": "https://github.com/SOHU-co/kafka-node/issues",
"version": "1.0.2",
"version": "1.0.3",
"main": "kafka.js",

@@ -15,0 +15,0 @@ "license": "MIT",

@@ -8,3 +8,3 @@ 'use strict';

describe('ConsumerGroupMigrator', function () {
describe('#saveHighLevelConsumerOffsets', function () {
describe('#saveHighLevelConsumerOffsets and #getOffset', function () {
it('saves HLC offsets and maps offsets with -1 to 0', function (done) {

@@ -33,6 +33,6 @@ const fakeClient = new EventEmitter();

migrator.saveHighLevelConsumerOffsets(['TestTopic', 'TestEvent'], function (error) {
migrator.getOffset({topic: 'TestTopic', partition: 0}, -1).should.be.eql(0);
migrator.getOffset({topic: 'TestTopic', partition: 1}, -1).should.be.eql(0);
migrator.getOffset({topic: 'TestTopic', partition: 2}, -1).should.be.eql(10);
migrator.getOffset({topic: 'TestEvent', partition: 0}, -1).should.be.eql(0);
migrator.getOffset({topic: 'TestTopic', partition: 0}, 0).should.be.eql(0);
migrator.getOffset({topic: 'TestTopic', partition: 1}, 23).should.be.eql(0);
migrator.getOffset({topic: 'TestTopic', partition: 2}, 128).should.be.eql(10);
migrator.getOffset({topic: 'TestEvent', partition: 0}, 4).should.be.eql(4);
migrator.getOffset({topic: 'TestEvent', partition: 1}, 222).should.be.eql(222);

@@ -39,0 +39,0 @@ done(error);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc