@iobroker/db-states-redis
Advanced tools
Comparing version 4.0.0-alpha.25-20211211-1232a951 to 4.0.0-alpha.26-20211214-19e8d05e
@@ -5,4 +5,4 @@ module.exports = { | ||
getDefaultPort: host => { | ||
return (host.includes(',')) ? 26379 : 6379; | ||
return host.includes(',') ? 26379 : 6379; | ||
} | ||
}; |
@@ -25,3 +25,10 @@ /** | ||
function bufferJsonDecoder(key, value) { | ||
if (value && typeof value === 'object' && typeof value.type === 'string' && value.type === 'Buffer' && value.data && Array.isArray(value.data)) { | ||
if ( | ||
value && | ||
typeof value === 'object' && | ||
typeof value.type === 'string' && | ||
value.type === 'Buffer' && | ||
value.data && | ||
Array.isArray(value.data) | ||
) { | ||
return Buffer.from(value.data); | ||
@@ -33,3 +40,2 @@ } | ||
class StateRedisClient { | ||
constructor(settings) { | ||
@@ -117,7 +123,11 @@ this.settings = settings || {}; | ||
if (this.settings.connection.port === 0) { // Port = 0 means unix socket | ||
if (this.settings.connection.port === 0) { | ||
// Port = 0 means unix socket | ||
// initiate a unix socket connection | ||
this.settings.connection.options.path = this.settings.connection.host; | ||
this.log.debug(`${this.namespace} Redis States: Use File Socket for connection: ${this.settings.connection.options.path}`); | ||
} else if (Array.isArray(this.settings.connection.host)) { // Host is an array means we use a sentinel | ||
this.log.debug( | ||
`${this.namespace} Redis States: Use File Socket for connection: ${this.settings.connection.options.path}` | ||
); | ||
} else if (Array.isArray(this.settings.connection.host)) { | ||
// Host is an array means we use a sentinel | ||
const defaultPort = Array.isArray(this.settings.connection.port) ? null : this.settings.connection.port; | ||
@@ -128,8 +138,16 @@ this.settings.connection.options.sentinels = this.settings.connection.host.map((redisNode, idx) => ({ | ||
})); | ||
this.settings.connection.options.name = this.settings.connection.sentinelName ? this.settings.connection.sentinelName : 'mymaster'; | ||
this.log.debug(`${this.namespace} Redis States: Use Sentinel for connection: ${this.settings.connection.options.name}, ${JSON.stringify(this.settings.connection.options.sentinels)}`); | ||
this.settings.connection.options.name = this.settings.connection.sentinelName | ||
? this.settings.connection.sentinelName | ||
: 'mymaster'; | ||
this.log.debug( | ||
`${this.namespace} Redis States: Use Sentinel for connection: ${ | ||
this.settings.connection.options.name | ||
}, ${JSON.stringify(this.settings.connection.options.sentinels)}` | ||
); | ||
} else { | ||
this.settings.connection.options.host = this.settings.connection.host; | ||
this.settings.connection.options.port = this.settings.connection.port; | ||
this.log.debug(`${this.namespace} Redis States: Use Redis connection: ${this.settings.connection.options.host}:${this.settings.connection.options.port}`); | ||
this.log.debug( | ||
`${this.namespace} Redis States: Use Redis connection: ${this.settings.connection.options.host}:${this.settings.connection.options.port}` | ||
); | ||
} | ||
@@ -142,3 +160,4 @@ if (this.settings.connection.options.db === undefined) { | ||
} | ||
this.settings.connection.options.password = this.settings.connection.options.auth_pass || this.settings.connection.pass || null; | ||
this.settings.connection.options.password = | ||
this.settings.connection.options.auth_pass || this.settings.connection.pass || null; | ||
this.settings.connection.options.autoResubscribe = false; // We do our own resubscribe because other sometimes not work | ||
@@ -151,3 +170,6 @@ // REDIS does not allow whitespaces, we have some because of pid | ||
this.client.on('error', error => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} Redis ERROR States: (${this.stop}) ${error.message} / ${error.stack}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly( | ||
`${this.namespace} Redis ERROR States: (${this.stop}) ${error.message} / ${error.stack}` | ||
); | ||
if (this.stop) { | ||
@@ -160,3 +182,5 @@ return; | ||
if (error.message.startsWith('Protocol error, got "H" as reply type byte.')) { | ||
this.log.error(`${this.namespace} Could not connect to states database at ${this.settings.connection.options.host}:${this.settings.connection.options.port} (invalid protocol). Please make sure the configured IP and port points to a host running JS-Controller >= 2.0. and that the port is not occupied by other software!`); | ||
this.log.error( | ||
`${this.namespace} Could not connect to states database at ${this.settings.connection.options.host}:${this.settings.connection.options.port} (invalid protocol). Please make sure the configured IP and port points to a host running JS-Controller >= 2.0. and that the port is not occupied by other software!` | ||
); | ||
} | ||
@@ -170,3 +194,4 @@ return; | ||
this.client.on('end', () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis Event end (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis Event end (stop=${this.stop})`); | ||
if (ready && typeof this.settings.disconnected === 'function') { | ||
@@ -178,3 +203,4 @@ this.settings.disconnected(); | ||
this.client.on('connect', () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis Event connect (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis Event connect (stop=${this.stop})`); | ||
connected = true; | ||
@@ -188,3 +214,4 @@ if (errorLogged) { | ||
this.client.on('close', () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis Event close (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis Event close (stop=${this.stop})`); | ||
//if (ready && typeof this.settings.disconnected === 'function') this.settings.disconnected(); | ||
@@ -197,5 +224,11 @@ }); | ||
} | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})`); | ||
if (reconnectCounter > 2) { // fallback logic for nodejs <10 | ||
this.log.error(`${this.namespace} The DB port ${this.settings.connection.options.port} is occupied by something that is not a Redis protocol server. Please check other software running on this port or, if you use iobroker, make sure to update to js-controller 2.0 or higher!`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly( | ||
`${this.namespace} States-Redis Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})` | ||
); | ||
if (reconnectCounter > 2) { | ||
// fallback logic for nodejs <10 | ||
this.log.error( | ||
`${this.namespace} The DB port ${this.settings.connection.options.port} is occupied by something that is not a Redis protocol server. Please check other software running on this port or, if you use iobroker, make sure to update to js-controller 2.0 or higher!` | ||
); | ||
return; | ||
@@ -208,3 +241,4 @@ } | ||
this.client.on('ready', async () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis Event ready (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis Event ready (stop=${this.stop})`); | ||
if (this.stop) { | ||
@@ -219,5 +253,7 @@ return; | ||
try { | ||
await this.client.config('set', ['notify-keyspace-events', 'Exe']);// enable Expiry/Evicted events in server | ||
await this.client.config('set', ['notify-keyspace-events', 'Exe']); // enable Expiry/Evicted events in server | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} Unable to enable Expiry Keyspace events from Redis Server: ${e.message}`); | ||
this.log.warn( | ||
`${this.namespace} Unable to enable Expiry Keyspace events from Redis Server: ${e.message}` | ||
); | ||
} | ||
@@ -232,6 +268,10 @@ | ||
setImmediate(() => { | ||
this.log.silly(`${this.namespace} States system redis pmessage ${pattern}/${channel}:${message}`); | ||
this.log.silly( | ||
`${this.namespace} States system redis pmessage ${pattern}/${channel}:${message}` | ||
); | ||
try { | ||
message = message ? JSON.parse(message, message.includes('"Buffer"') ? bufferJsonDecoder: undefined) : null; | ||
message = message | ||
? JSON.parse(message, message.includes('"Buffer"') ? bufferJsonDecoder : undefined) | ||
: null; | ||
} catch { | ||
@@ -249,3 +289,7 @@ this.log.warn(`${this.namespace} Cannot parse system pmessage "${message}"`); | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} States system pmessage ${channel} ${JSON.stringify(message)} ${e.message}`); | ||
this.log.warn( | ||
`${this.namespace} States system pmessage ${channel} ${JSON.stringify(message)} ${ | ||
e.message | ||
}` | ||
); | ||
this.log.warn(`${this.namespace} ${e.stack}`); | ||
@@ -260,6 +304,13 @@ } | ||
setImmediate(() => { | ||
this.log.silly(this.namespace + ' redis message expired/evicted ' + channel + ':' + message); | ||
this.log.silly( | ||
this.namespace + ' redis message expired/evicted ' + channel + ':' + message | ||
); | ||
try { | ||
if (channel === `__keyevent@${this.settings.connection.options.db}__:evicted`) { | ||
this.log.warn(this.namespace + ' Redis has evicted state ' + message + '. Please check your maxMemory settings for your redis instance!'); | ||
this.log.warn( | ||
this.namespace + | ||
' Redis has evicted state ' + | ||
message + | ||
'. Please check your maxMemory settings for your redis instance!' | ||
); | ||
} else if (channel !== `__keyevent@${this.settings.connection.options.db}__:expired`) { | ||
@@ -271,3 +322,5 @@ this.log.warn(`${this.namespace} Unknown user message ${channel} ${message}`); | ||
// Find deleted states and notify user | ||
const found = Object.values(this.subSystem.ioBrokerSubscriptions).find(regex => regex !== true && regex.test(message)); | ||
const found = Object.values(this.subSystem.ioBrokerSubscriptions).find( | ||
regex => regex !== true && regex.test(message) | ||
); | ||
found && onChange(message.substring(this.namespaceRedisL), null); | ||
@@ -277,3 +330,5 @@ } | ||
// Find deleted states and notify user | ||
const found = Object.values(this.sub.ioBrokerSubscriptions).find(regex => regex !== true && regex.test(message)); | ||
const found = Object.values(this.sub.ioBrokerSubscriptions).find( | ||
regex => regex !== true && regex.test(message) | ||
); | ||
found && onChangeUser(message.substring(this.namespaceRedisL), null); | ||
@@ -285,6 +340,8 @@ } | ||
} | ||
})); | ||
}) | ||
); | ||
} | ||
this.subSystem.on('end', () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis System Event end sub (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis System Event end sub (stop=${this.stop})`); | ||
ready && typeof this.settings.disconnected === 'function' && this.settings.disconnected(); | ||
@@ -297,3 +354,6 @@ }); | ||
} | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} Sub-Client States System No redis connection: ${JSON.stringify(error)}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly( | ||
`${this.namespace} Sub-Client States System No redis connection: ${JSON.stringify(error)}` | ||
); | ||
}); | ||
@@ -303,9 +363,18 @@ | ||
this.subSystem.on('connect', () => | ||
this.log.silly(`${this.namespace} PubSub client States-Redis System Event connect (stop=${this.stop})`)); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis System Event connect (stop=${this.stop})` | ||
) | ||
); | ||
this.subSystem.on('close', () => | ||
this.log.silly(`${this.namespace} PubSub client States-Redis System Event close (stop=${this.stop})`)); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis System Event close (stop=${this.stop})` | ||
) | ||
); | ||
this.subSystem.on('reconnecting', reconnectCounter => | ||
this.log.silly(`${this.namespace} PubSub client States-Redis System Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})`)); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis System Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})` | ||
) | ||
); | ||
} | ||
@@ -315,11 +384,21 @@ | ||
try { | ||
this.subSystem && await this.subSystem.subscribe(`__keyevent@${this.settings.connection.options.db}__:expired`); | ||
this.subSystem && | ||
(await this.subSystem.subscribe( | ||
`__keyevent@${this.settings.connection.options.db}__:expired` | ||
)); | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} Unable to subscribe to expiry Keyspace events from Redis Server: ${e.message}`); | ||
this.log.warn( | ||
`${this.namespace} Unable to subscribe to expiry Keyspace events from Redis Server: ${e.message}` | ||
); | ||
} | ||
try { | ||
this.subSystem && await this.subSystem.subscribe(`__keyevent@${this.settings.connection.options.db}__:evicted`); | ||
this.subSystem && | ||
(await this.subSystem.subscribe( | ||
`__keyevent@${this.settings.connection.options.db}__:evicted` | ||
)); | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} Unable to subscribe to evicted Keyspace events from Redis Server: ${e.message}`); | ||
this.log.warn( | ||
`${this.namespace} Unable to subscribe to evicted Keyspace events from Redis Server: ${e.message}` | ||
); | ||
} | ||
@@ -329,5 +408,13 @@ | ||
if (this.settings.connection.port === 0) { | ||
this.log.debug(`${this.namespace} States ${ready ? 'system re' : ''}connected to redis: ${this.settings.connection.host}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'system re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}` | ||
); | ||
} else { | ||
this.log.debug(`${this.namespace} States ${ready ? 'system re' : ''}connected to redis: ${this.settings.connection.host}:${this.settings.connection.port}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'system re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}:${this.settings.connection.port}` | ||
); | ||
} | ||
@@ -362,3 +449,5 @@ !ready && typeof this.settings.connected === 'function' && this.settings.connected(); | ||
try { | ||
message = message ? JSON.parse(message, message.includes('"Buffer"') ? bufferJsonDecoder: undefined) : null; | ||
message = message | ||
? JSON.parse(message, message.includes('"Buffer"') ? bufferJsonDecoder : undefined) | ||
: null; | ||
} catch { | ||
@@ -376,3 +465,7 @@ this.log.warn(`${this.namespace} Cannot parse user pmessage "${message}"`); | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} States user pmessage ${channel} ${JSON.stringify(message)} ${e.message}`); | ||
this.log.warn( | ||
`${this.namespace} States user pmessage ${channel} ${JSON.stringify(message)} ${ | ||
e.message | ||
}` | ||
); | ||
this.log.warn(`${this.namespace} ${e.stack}`); | ||
@@ -384,3 +477,4 @@ } | ||
this.sub.on('end', () => { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} States-Redis User Event end sub (stop=${this.stop})`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} States-Redis User Event end sub (stop=${this.stop})`); | ||
if (ready && typeof this.settings.disconnected === 'function') { | ||
@@ -396,3 +490,5 @@ this.settings.disconnected(); | ||
if (this.settings.connection.enhancedLogging) { | ||
this.log.silly(`${this.namespace} Sub-Client States User No redis connection: ${JSON.stringify(error)}`); | ||
this.log.silly( | ||
`${this.namespace} Sub-Client States User No redis connection: ${JSON.stringify(error)}` | ||
); | ||
} | ||
@@ -403,11 +499,17 @@ }); | ||
this.sub.on('connect', () => { | ||
this.log.silly(`${this.namespace} PubSub client States-Redis User Event connect (stop=${this.stop})`); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis User Event connect (stop=${this.stop})` | ||
); | ||
}); | ||
this.sub.on('close', () => { | ||
this.log.silly(`${this.namespace} PubSub client States-Redis User Event close (stop=${this.stop})`); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis User Event close (stop=${this.stop})` | ||
); | ||
}); | ||
this.sub.on('reconnecting', reconnectCounter => { | ||
this.log.silly(`${this.namespace} PubSub client States-Redis User Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})`); | ||
this.log.silly( | ||
`${this.namespace} PubSub client States-Redis User Event reconnect (reconnectCounter=${reconnectCounter}, stop=${this.stop})` | ||
); | ||
}); | ||
@@ -419,5 +521,13 @@ } | ||
if (this.settings.connection.port === 0) { | ||
this.log.debug(`${this.namespace} States ${ready ? 'user re' : ''}connected to redis: ${this.settings.connection.host}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'user re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}` | ||
); | ||
} else { | ||
this.log.debug(`${this.namespace} States ${ready ? 'user re' : ''}connected to redis: ${this.settings.connection.host}:${this.settings.connection.port}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'user re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}:${this.settings.connection.port}` | ||
); | ||
} | ||
@@ -440,5 +550,13 @@ !ready && typeof this.settings.connected === 'function' && this.settings.connected(); | ||
if (this.settings.connection.port === 0) { | ||
this.log.debug(`${this.namespace} States ${ready ? 'client re' : ''}connected to redis: ${this.settings.connection.host}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'client re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}` | ||
); | ||
} else { | ||
this.log.debug(`${this.namespace} States ${ready ? 'client re' : ''}connected to redis: ${this.settings.connection.host}:${this.settings.connection.port}`); | ||
this.log.debug( | ||
`${this.namespace} States ${ready ? 'client re' : ''}connected to redis: ${ | ||
this.settings.connection.host | ||
}:${this.settings.connection.port}` | ||
); | ||
} | ||
@@ -448,3 +566,2 @@ !ready && typeof this.settings.connected === 'function' && this.settings.connected(); | ||
} | ||
}); | ||
@@ -454,3 +571,3 @@ } | ||
getStatus() { | ||
return {type: 'redis', server: false}; | ||
return { type: 'redis', server: false }; | ||
} | ||
@@ -519,3 +636,3 @@ | ||
if (!oldObj) { | ||
oldObj = {val: null}; | ||
oldObj = { val: null }; | ||
} else { | ||
@@ -526,3 +643,3 @@ try { | ||
this.log.warn(`${this.namespace} Cannot parse "${oldObj}"`); | ||
oldObj = {val: null}; | ||
oldObj = { val: null }; | ||
} | ||
@@ -544,5 +661,5 @@ } | ||
if (state.ts !== undefined) { | ||
obj.ts = (state.ts < 946681200000) ? state.ts * 1000 : state.ts; // if less 2000.01.01 00:00:00 | ||
obj.ts = state.ts < 946681200000 ? state.ts * 1000 : state.ts; // if less 2000.01.01 00:00:00 | ||
} else { | ||
obj.ts = (new Date()).getTime(); | ||
obj.ts = new Date().getTime(); | ||
} | ||
@@ -588,3 +705,4 @@ | ||
// publish event in redis | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis publish ${this.namespaceRedis}${id} ${objString}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis publish ${this.namespaceRedis}${id} ${objString}`); | ||
await this.client.publish(this.namespaceRedis + id, objString); | ||
@@ -599,3 +717,4 @@ return tools.maybeCallbackWithError(callback, null, id); | ||
// publish event in redis | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis publish ${this.namespaceRedis}${id} ${objString}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis publish ${this.namespaceRedis}${id} ${objString}`); | ||
await this.client.publish(this.namespaceRedis + id, objString); | ||
@@ -712,5 +831,6 @@ return tools.maybeCallbackWithError(callback, null, id); | ||
obj = await this.client.mget(_keys); | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis mget ${(!obj) ? 0 : obj.length} ${_keys.length}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis mget ${!obj ? 0 : obj.length} ${_keys.length}`); | ||
} catch (e) { | ||
this.log.warn(`${this.namespace} redis mget ${(!obj) ? 0 : obj.length} ${_keys.length}, err: ${e.message}`); | ||
this.log.warn(`${this.namespace} redis mget ${!obj ? 0 : obj.length} ${_keys.length}, err: ${e.message}`); | ||
} | ||
@@ -787,3 +907,2 @@ const result = []; | ||
} | ||
} | ||
@@ -835,3 +954,4 @@ if (this.subSystem) { | ||
} | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis keys ${obj.length} ${pattern}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis keys ${obj.length} ${pattern}`); | ||
if (obj && !dontModify) { | ||
@@ -867,6 +987,9 @@ const len = this.namespaceRedisL; | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis psubscribe ${this.namespaceRedis}${pattern}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis psubscribe ${this.namespaceRedis}${pattern}`); | ||
try { | ||
await subClient.psubscribe(this.namespaceRedis + pattern); | ||
subClient.ioBrokerSubscriptions[this.namespaceRedis + pattern] = new RegExp(tools.pattern2RegEx(this.namespaceRedis + pattern)); | ||
subClient.ioBrokerSubscriptions[this.namespaceRedis + pattern] = new RegExp( | ||
tools.pattern2RegEx(this.namespaceRedis + pattern) | ||
); | ||
return tools.maybeCallback(callback); | ||
@@ -903,3 +1026,4 @@ } catch (e) { | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis punsubscribe ${this.namespaceRedis}${pattern}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis punsubscribe ${this.namespaceRedis}${pattern}`); | ||
subClient.punsubscribe(this.namespaceRedis + pattern, err => { | ||
@@ -933,3 +1057,3 @@ if (!err && subClient.ioBrokerSubscriptions[this.namespaceRedis + pattern] !== undefined) { | ||
state._id = this.globalMessageId++; | ||
if (this.globalMessageId >= 0xFFFFFFFF) { | ||
if (this.globalMessageId >= 0xffffffff) { | ||
this.globalMessageId = 0; | ||
@@ -957,3 +1081,4 @@ } | ||
} | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis subscribeMessage ${this.namespaceMsg}${id}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis subscribeMessage ${this.namespaceMsg}${id}`); | ||
try { | ||
@@ -980,3 +1105,4 @@ await this.subSystem.psubscribe(this.namespaceMsg + id); | ||
} | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis unsubscribeMessage ${this.namespaceMsg}${id}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis unsubscribeMessage ${this.namespaceMsg}${id}`); | ||
try { | ||
@@ -999,3 +1125,3 @@ await this.subSystem.punsubscribe(this.namespaceMsg + id); | ||
log._id = this.globalLogId++; | ||
if (this.globalLogId >= 0xFFFFFFFF) { | ||
if (this.globalLogId >= 0xffffffff) { | ||
this.globalLogId = 0; | ||
@@ -1052,3 +1178,4 @@ } | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis subscribeMessage ${this.namespaceLog}${id}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis subscribeMessage ${this.namespaceLog}${id}`); | ||
try { | ||
@@ -1072,3 +1199,4 @@ await this.subSystem.psubscribe(this.namespaceLog + id); | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis unsubscribeMessage ${this.namespaceLog}${id}`); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis unsubscribeMessage ${this.namespaceLog}${id}`); | ||
try { | ||
@@ -1122,3 +1250,4 @@ await this.subSystem.punsubscribe(this.namespaceLog + id); | ||
await this.client.setex(this.namespaceSession + id, expire, JSON.stringify(obj)); | ||
this.settings.connection.enhancedLogging && this.log.silly(`${this.namespace} redis setex`, id, expire, obj); | ||
this.settings.connection.enhancedLogging && | ||
this.log.silly(`${this.namespace} redis setex`, id, expire, obj); | ||
return tools.maybeCallback(callback); | ||
@@ -1125,0 +1254,0 @@ } catch (e) { |
{ | ||
"name": "@iobroker/db-states-redis", | ||
"version": "4.0.0-alpha.25-20211211-1232a951", | ||
"version": "4.0.0-alpha.26-20211214-19e8d05e", | ||
"engines": { | ||
@@ -8,3 +8,3 @@ "node": ">=12.0.0" | ||
"dependencies": { | ||
"@iobroker/db-base": "4.0.0-alpha.25-20211211-1232a951", | ||
"@iobroker/db-base": "4.0.0-alpha.26-20211214-19e8d05e", | ||
"ioredis": "^4.28.2" | ||
@@ -37,3 +37,3 @@ }, | ||
], | ||
"gitHead": "f1cdd329b8fd9a6c442ace4fd1c50a1e7f53d381" | ||
"gitHead": "b192169960992cc360b1f6c297a6ec0877e2558f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53311
1153
9
+ Added@iobroker/db-base@4.0.0-alpha.26-20211214-19e8d05e(transitive)
+ Added@iobroker/js-controller-common@4.0.0-alpha.26-20211214-19e8d05e(transitive)
- Removed@iobroker/db-base@4.0.0-alpha.25-20211211-1232a951(transitive)
- Removed@iobroker/js-controller-common@4.0.0-alpha.25-20211211-1232a951(transitive)