0

我正在从 NodeJS 脚本运行这个函数:

const redis = require('redis')
const redisOptions = {
    url: '*****',
    password: '******'
}


const checkMessageStatus = (cachedMessageId, callback = () => {}) => {
    const client = redis.createClient(redisOptions)
    client.get('*', (err, cachedMessage) => {
        // returns error if it exists
        // figure out why this gets called twice
        if(err) return console.log('redis err',err)
        // returns true if message is cached
        if(cachedMessage) return
        // sets message as ID in database if the message hasn't been sent already
        client.set(cachedMessageId, JSON.stringify(cachedMessageId), 'EX', 120 * 60, (redisSetError, redisSetResponse) => {
            // console.error(redisSetError)
            // console.log(redisSetResponse)
            client.quit(callback)
        })
    })
}

我收到了这个错误:

ReplyError: ERR max number of clients reached

该数据库是通过 Redis 实验室托管的,我可以有 30 个连接。

我跑了:

CLIENT KILL TYPE normal
CLIENT KILL TYPE slave
CLIENT KILL TYPE pubsub

当我运行时info clients

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

ISSUE:即使只有一个连接的客户端,我仍然会收到此错误:

ReplyError: ERR max number of clients reached
4

0 回答 0