Skip to content

Commit

Permalink
upgrade ioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
kern committed Jan 5, 2025
1 parent c54d818 commit a50e6d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"autoprefixer": "^10.4.20",
"debug": "^4.3.6",
"express": "^4.19.2",
"ioredis": "^5.0.0",
"ioredis": "^5.4.2",
"next": "^15.1.3",
"next-themes": "^0.4.4",
"next-view-transitions": "^0.3.4",
Expand All @@ -57,7 +57,6 @@
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/ioredis": "^5.0.0",
"@types/node": "^22.10.2",
"@types/react": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.2",
Expand Down
23 changes: 10 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class MemoryChannelRepo implements ChannelRepo {
}

export class RedisChannelRepo implements ChannelRepo {
client: Redis.Redis
client: Redis

constructor() {
this.client = getRedisClient()
Expand Down
8 changes: 5 additions & 3 deletions src/redisClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import Redis from 'ioredis'

export { Redis }

let redisClient: Redis.Redis | null = null
let redisClient: Redis | null = null

export function getRedisClient(): Redis.Redis {
export function getRedisClient(): Redis {
if (!redisClient) {
redisClient = new Redis(process.env.REDIS_URL)
redisClient = process.env.REDIS_URL
? new Redis(process.env.REDIS_URL)
: new Redis()
}
return redisClient
}

0 comments on commit a50e6d5

Please sign in to comment.