redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.95k stars 1.89k forks source link

Error when executing a command within a callback of another command #1205

Closed xetrics closed 7 years ago

xetrics commented 7 years ago
        db.llen("queue", (err, jobs) => {
            this.job_queue = jobs

            if(this.job_queue > 0) {
                db.rpop("queue", (err, jobs) => {
                    console.log(err)
                })
            }
        })

Throws an error at RPOP. It also throws the same error when i change rpop to llen.

{ ReplyError
    at parseError (/home/xetrics/dev/steambots/node_modules/redis-parser/lib/parser.js:181:12)
    at parseType (/home/xetrics/dev/steambots/node_modules/redis-parser/lib/parser.js:291:14) command: 'RPOP', args: [ 'queue' ], code: 'ERR' }
BridgeAR commented 7 years ago

Please have a look at the error message. The error is returned by Redis itself as it is a ReplyError.