1

I'm running this function from a NodeJS script:

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)
        })
    })
}

I received this error:

ReplyError: ERR max number of clients reached

The DB is hosted through Redis labs and I can have 30 connections.

I ran:

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

When I run info clients:

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

ISSUE: I still get this error even though there is only one connected client:

ReplyError: ERR max number of clients reached
Luke Schoenberger
  • 447
  • 1
  • 5
  • 7

0 Answers0