Skip to content

Question: is it safe to reuse a previously used Redis client for Warlock? #24

@marnixhoh

Description

@marnixhoh

I have a clustered Redis setup and besides using it as a data store, I also use it as a distributed socket.io adapter. Is it safe to reuse the same Redis client for warlock or should I create a separate one?

Below is my current Redis config:

const Redis = require('ioredis')
const redisAdapter = require('socket.io-redis')
const Warlock = require('node-redis-warlock')

const startupNodes = [{
    port: process.env.REDIS_PORT,
    host: process.env.REDIS_HOST
}]

const redis = new Redis.Cluster(startupNodes)

// pubClient can be the same client, but the subClient needs to be a new instance
const ioAdapter = redisAdapter({
    pubClient: redis,
    subClient: new Redis.Cluster(startupNodes)
})

// is this line safe?
const warlock = new Warlock(redis)

or should the last line be:
const warlock = new Warlock(new Redis.Cluster(startupNodes))

Thank you so much in advance! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions