kafka-ts 1.1.2-beta.3 → 1.1.2-beta.4
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.
|
@@ -45,9 +45,7 @@ class Producer {
|
|
|
45
45
|
const { allowTopicAutoCreation } = this.options;
|
|
46
46
|
const defaultTimestamp = BigInt(Date.now());
|
|
47
47
|
const topics = new Set(messages.map((message) => message.topic));
|
|
48
|
-
await this.lock.acquire([...topics],
|
|
49
|
-
await this.metadata.fetchMetadataIfNecessary({ topics, allowTopicAutoCreation });
|
|
50
|
-
});
|
|
48
|
+
await this.lock.acquire([...topics].map((topic) => `metadata:${topic}`), () => this.metadata.fetchMetadataIfNecessary({ topics, allowTopicAutoCreation }));
|
|
51
49
|
const partitionedMessages = messages.map((message) => {
|
|
52
50
|
message.partition = this.partition(message);
|
|
53
51
|
return message;
|
|
@@ -55,8 +53,7 @@ class Producer {
|
|
|
55
53
|
const nodeTopicPartitionMessages = (0, messages_to_topic_partition_leaders_1.distributeMessagesToTopicPartitionLeaders)(partitionedMessages, this.metadata.getTopicPartitionLeaderIds());
|
|
56
54
|
try {
|
|
57
55
|
await Promise.all(Object.entries(nodeTopicPartitionMessages).map(async ([nodeId, topicPartitionMessages]) => {
|
|
58
|
-
|
|
59
|
-
await this.lock.acquire(lockKeys, async () => {
|
|
56
|
+
await this.lock.acquire([`node:${nodeId}`], async () => {
|
|
60
57
|
const topicData = Object.entries(topicPartitionMessages).map(([topic, partitionMessages]) => ({
|
|
61
58
|
name: topic,
|
|
62
59
|
partitionData: Object.entries(partitionMessages).map(([partition, messages]) => {
|