Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marnixhoh opened this issue Apr 23, 2021 · 0 comments

Comments

@marnixhoh
Copy link

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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant