Fix creation of redis clients

This commit is contained in:
Jackson Harper
2024-01-14 12:30:32 +08:00
parent 447bba23ba
commit b4914f5346
3 changed files with 16 additions and 27 deletions

View File

@ -15,7 +15,7 @@ import { config, loggers } from 'winston'
import { makeApolloServer } from './apollo'
import { appDataSource } from './data_source'
import { env } from './env'
import { redisClient } from './redis'
import { redisClient, mqRedisClient } from './redis'
import { articleRouter } from './routers/article_router'
import { authRouter } from './routers/auth/auth_router'
import { mobileAuthRouter } from './routers/auth/mobile/mobile_auth_router'
@ -163,6 +163,13 @@ const main = async (): Promise<void> => {
console.log('Redis Client Connected:', env.redis.url)
}
// redis for message queue
if (env.redis.url) {
mqRedisClient?.on('error', (err) => {
console.error('Redis Client Error', err)
})
}
const { app, apollo, httpServer } = createApp()
await apollo.start()