kafka-console 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -117,15 +117,15 @@ function createConsumer(client_1, group_1, topic_1) {
117
117
  const consumer = client.consumer(consumerConfig);
118
118
  yield consumer.connect();
119
119
  yield consumer.subscribe(consumerOptions);
120
- const pool = new pool_1.default([], poolOptions);
121
- pool.onDone(() => {
122
- consumer.disconnect();
123
- });
124
- consumer.run({
120
+ yield consumer.run({
125
121
  eachMessage: (payload) => __awaiter(this, void 0, void 0, function* () {
126
122
  pool.push(payload);
127
123
  }),
128
124
  }).catch(e => console.error(e));
125
+ const pool = new pool_1.default([], poolOptions);
126
+ pool.onDone(() => {
127
+ consumer.disconnect();
128
+ });
129
129
  return pool;
130
130
  });
131
131
  }
@@ -47,9 +47,6 @@ class Pool {
47
47
  this.timerId = setTimeout(() => this.done(true), timeout);
48
48
  }
49
49
  values.forEach((value) => this.push(value));
50
- if (count === 0) {
51
- Promise.resolve().then(() => this.done());
52
- }
53
50
  }
54
51
  push(value) {
55
52
  if (this.index >= this.skip && this.index < this.count) {
@@ -93,6 +90,9 @@ class Pool {
93
90
  });
94
91
  }
95
92
  [Symbol.asyncIterator]() {
93
+ if (this.count === 0) {
94
+ Promise.resolve().then(() => this.done());
95
+ }
96
96
  let i = 0;
97
97
  return {
98
98
  i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kafka-console",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Kafka CLI tool",
5
5
  "main": "index.js",
6
6
  "bin": {