From 8089aaeaa12447cafe0bb840d6508183172143e2 Mon Sep 17 00:00:00 2001 From: Nader Zouaoui Date: Wed, 13 Sep 2023 12:13:46 +0100 Subject: [PATCH 1/2] fix: ignore global flag on regexp topic --- src/consumer/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/consumer/index.js b/src/consumer/index.js index 0489dcf1d..c09875603 100644 --- a/src/consumer/index.js +++ b/src/consumer/index.js @@ -161,14 +161,16 @@ module.exports = ({ for (const subscription of subscriptions) { const isRegExp = subscription instanceof RegExp if (isRegExp) { - const topicRegExp = subscription const matchedTopics = metadata.topicMetadata .map(({ topic: topicName }) => topicName) - .filter(topicName => topicRegExp.test(topicName)) + .filter(topicName => { + const topicRegExp = new RegExp(subscription) + return topicRegExp.test(topicName); + }) logger.debug('Subscription based on RegExp', { groupId, - topicRegExp: topicRegExp.toString(), + topicRegExp: subscription.toString(), matchedTopics, }) From 5cd718371509f065a1e57f11c3c80948d3c1d6e2 Mon Sep 17 00:00:00 2001 From: Nader Zouaoui Date: Wed, 13 Sep 2023 12:17:58 +0100 Subject: [PATCH 2/2] chore: fix linting problem remove ; --- src/consumer/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/consumer/index.js b/src/consumer/index.js index c09875603..48d3199e9 100644 --- a/src/consumer/index.js +++ b/src/consumer/index.js @@ -165,7 +165,7 @@ module.exports = ({ .map(({ topic: topicName }) => topicName) .filter(topicName => { const topicRegExp = new RegExp(subscription) - return topicRegExp.test(topicName); + return topicRegExp.test(topicName) }) logger.debug('Subscription based on RegExp', {