small fix in multiRedis
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ export const methods = {
|
|||||||
for(const rediscnx of this.allRediscnx){
|
for(const rediscnx of this.allRediscnx){
|
||||||
if(!chan.startsWith(rediscnx.redisConfig.chansNamespace)) continue
|
if(!chan.startsWith(rediscnx.redisConfig.chansNamespace)) continue
|
||||||
else coudSubscribe = true
|
else coudSubscribe = true
|
||||||
let localChan = rediscnx.redisConfig.basePrefix + localChan
|
let localChan = rediscnx.redisConfig.basePrefix + chan
|
||||||
if(!(localChan in rediscnx.subscriptions)) rediscnx.subscriptions[localChan] = [];
|
if(!(localChan in rediscnx.subscriptions)) rediscnx.subscriptions[localChan] = [];
|
||||||
if(!rediscnx.subscriptions[localChan].includes(this.uuid)) {
|
if(!rediscnx.subscriptions[localChan].includes(this.uuid)) {
|
||||||
rediscnx.subscriptions[localChan].push(this.uuid);
|
rediscnx.subscriptions[localChan].push(this.uuid);
|
||||||
|
|||||||
+2
-2
@@ -71,7 +71,7 @@ export class RedisConnexion {
|
|||||||
|
|
||||||
async redisSubscribe(chanName, callBack){
|
async redisSubscribe(chanName, callBack){
|
||||||
if(!chanName.startsWith(this.redisConfig.basePrefix)) chanName = this.redisConfig.basePrefix + chanName
|
if(!chanName.startsWith(this.redisConfig.basePrefix)) chanName = this.redisConfig.basePrefix + chanName
|
||||||
if(!chanName.startsWith(this.redisConfig.basePrefix+this.chansNamespace)) {
|
if(!chanName.startsWith(this.redisConfig.basePrefix+this.redisConfig.chansNamespace)) {
|
||||||
console.warn(`[${this.redisConfig.redisId}] redisSubscribe : forbidden channel range on this redis !`)
|
console.warn(`[${this.redisConfig.redisId}] redisSubscribe : forbidden channel range on this redis !`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ export class RedisConnexion {
|
|||||||
async redisPublish(chanName, msg){
|
async redisPublish(chanName, msg){
|
||||||
if(typeof (msg) != 'string') msg = JSON.stringify(msg);
|
if(typeof (msg) != 'string') msg = JSON.stringify(msg);
|
||||||
if(!chanName.startsWith(this.redisConfig.basePrefix)) chanName = this.redisConfig.basePrefix + chanName
|
if(!chanName.startsWith(this.redisConfig.basePrefix)) chanName = this.redisConfig.basePrefix + chanName
|
||||||
if(!chanName.startsWith(this.redisConfig.basePrefix+this.chansNamespace)) {
|
if(!chanName.startsWith(this.redisConfig.basePrefix+this.redisConfig.chansNamespace)) {
|
||||||
console.warn(`[${this.redisConfig.redisId}] redisPublish : forbidden channel range on this redis !`)
|
console.warn(`[${this.redisConfig.redisId}] redisPublish : forbidden channel range on this redis !`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user