2017-11-03 4 views
0
の不良の戻り値には動作しません

は、私は、ライブラリを使用してマルチアトミックトランザクションを実行してい未処理の拒絶例外RangeError:モニタモードであるクライアントでトランザクションを使用するには、原因のRedis

、SOのための有効な質問のように思えますNode.jsのため、私のIBM Bluemixから私のログ結果のノード-Redisのは、私は次のエラーが表示されます

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'] 
    }); 

モニタ機能は、サーバー上でこれらのトランザクションの2を処理することができませんにこのコードのスニペットを追加しましたか?私はまだこの文の前に.exec()を実行することができますが、execAsyncがなぜログ文を受け取ることができず、ランタイムを中断させるのかという根本的な理由であるかどうかはわかりません。 Redisの-ノードあたり

答えて

0

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.

関連する問題