Skip to content

Commit f6217f3

Browse files
committed
fix publish messages redis
1 parent 0a2bf70 commit f6217f3

File tree

4 files changed

+44
-46
lines changed

4 files changed

+44
-46
lines changed

package-lock.json

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cap-js-community/event-queue",
3-
"version": "2.0.0-beta.3",
3+
"version": "2.0.0-beta.4",
44
"description": "An event queue that enables secure transactional processing of asynchronous and periodic events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
55
"main": "src/index.js",
66
"types": "src/index.d.ts",

src/shared/redis/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const subscribeRedisChannel = async (channel, subscribeHandler) => {
1717
return await redisClient.subscribeChannel(config.redisOptions, channelWithNamespace, subscribeHandler);
1818
};
1919

20-
const publishMessage = async (channel, message, { addNamespace = true } = {}) => {
20+
const publishMessage = async (channel, message) => {
2121
const redisClient = RedisClient.create(REDIS_CLIENT_NAME);
22-
const channelWithNamespace = [config.redisNamespace(addNamespace), channel].join("##");
22+
const channelWithNamespace = [config.redisNamespace(false), channel].join("##");
2323
return await redisClient.publishMessage(config.redisOptions, channelWithNamespace, message);
2424
};
2525

src/shared/redis/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ const attachRedisUnsubscribeHandler = () => {
2727

2828
const handleUnsubscribe = (tenantId) => {
2929
if (config.redisEnabled) {
30-
client
31-
.publishMessage(REDIS_OFFBOARD_TENANT_CHANNEL, JSON.stringify({ tenantId }), { addNamespace: false })
32-
.catch((error) => {
33-
cds.log(COMPONENT_NAME).error(`publishing tenant unsubscribe failed. tenantId: ${tenantId}`, error);
34-
});
30+
client.publishMessage(REDIS_OFFBOARD_TENANT_CHANNEL, JSON.stringify({ tenantId })).catch((error) => {
31+
cds.log(COMPONENT_NAME).error(`publishing tenant unsubscribe failed. tenantId: ${tenantId}`, error);
32+
});
3533
} else {
3634
config.executeUnsubscribeHandlers(tenantId);
3735
}

0 commit comments

Comments
 (0)