gpt4 book ai didi

node.js - 未处理的拒绝 RangeError : Using transaction with a client that is in monitor mode does not work due to faulty return values of Redis

转载 作者:可可西里 更新时间:2023-11-01 11:25:03 25 4
gpt4 key购买 nike

对于 SO 来说似乎是一个有效的问题,

我正在使用 Node.JS 的库 node-redis 执行多原子事务,在我的 IBM Bluemix 的日志结果中,我收到以下错误:

Unhandled rejection RangeError: Using transaction with a client that is in monitor mode does not work due to faulty return values of Redis.

现在这是有趣的部分,错误被精确定位到我的脚本中的第 255 行:

 /* Code Above */
//
//
//
new Promise((resolve, reject)=>{


[LINE 255] client.multi().hget(practitioner, "texted").hget(practitioner, "replied")
.execAsync().then((replies)=>{
console.log(replies);
var _replied = replies[1],
_texted = replies[0];
if (_replied && _texted){
retrievalSuccess = `Practitioner ${practitioner} has sent a message to the NOK participant
\s ${contact.fname} ${contact.lname} at ${TimeStamper()},
\s participant returned SMS of OK
\s, closing..."`;
console.info(retrievalSuccess);
auditFile.message += "\n"+retrievalSuccess;

/* rest of the code */

我的路线没有抛出任何错误直到我将这段代码添加到回调

 client.monitor((err, res)=>{
console.log("Entering monitoring mode.", res);
});

client.on("monitor", (time, args, raw_reply)=>{
console.log(time + ": " + args); // 1458910076.446514:['set', 'foo', 'bar']
});

监控功能是否无法处理服务器上的两个事务?我仍然能够在此语句之前执行 .exec() 提交,我不确定 execAsync 是否是我无法收到的根本原因日志语句,它会中断运行时。

最佳答案

每个 Redis Node :

The monitor client may not fire any other commands than quit after activating monitor. You have to open a new client and then fire the commands with that one instead. The monitor client is going to receive everything that is happening with the other client.

关于node.js - 未处理的拒绝 RangeError : Using transaction with a client that is in monitor mode does not work due to faulty return values of Redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47103863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com