Skip to content

Commit fd08af2

Browse files
committed
Defaults createTopics' param async=false
Async must default to false. It is dangerous to use async=true for createTopics unless explicitly specified. For running async calls, the subsequent steps (such as addTopics) will fail as the topics are yet to be created/in the progress of creation. It is the nature of async to return immediately even before the createTopics is completed. This fixes the regression from the fix 5fd3764.
1 parent 5fd3764 commit fd08af2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/baseClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Client.prototype.createTopics = function (topics, isAsync, cb) {
253253

254254
if (typeof isAsync === 'function' && typeof cb === 'undefined') {
255255
cb = isAsync;
256-
isAsync = true;
256+
isAsync = false;
257257
}
258258

259259
try {

test/test.offset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('Offset', function () {
1414
client = new Client();
1515
producer = new Producer(client);
1616
producer.on('ready', function () {
17-
producer.createTopics(['_exist_topic_3_test'], true, function (err) {
17+
producer.createTopics(['_exist_topic_3_test'], false, function (err) {
1818
done(err);
1919
});
2020
});

test/test.producer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var client, producer, noAckProducer, producerKeyed;
4646
producer.once('ready', callback);
4747
},
4848
function (callback) {
49-
producer.createTopics([EXISTS_TOPIC_3], true, callback);
49+
producer.createTopics([EXISTS_TOPIC_3], false, callback);
5050
}
5151
],
5252
done

0 commit comments

Comments
 (0)