Skip to content

Conversation

kjyoun-ai
Copy link

@kjyoun-ai kjyoun-ai commented May 7, 2025

Currently,

async onModuleInit() {
    try {
      console.log('Connecting to Redis...');
      this.client = await createClient({
        url: process.env.REDIS_URL,
        password: process.env.REDIS_PASSWORD,
      })
        .on('error', (err) => console.log('Redis Client Error', err))
        .connect()
      console.log('Connected to Redis successfully');
    } catch (e) {
      console.log('Failed to connect to Redis database', e)
    }
  }

is breaking the app by infinite connection trial to redis when Redis is not set up. It will block all other incoming API requests.
//todo this is rather quick fix and I would later refactor this code by lazy/dynamically load single db module depending on .env. So that app doesn't waste resource trying to load unnecessary module.

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

Successfully merging this pull request may close these issues.

1 participant