From 466556f794f0d836f88394dfd7f2400b76a66621 Mon Sep 17 00:00:00 2001 From: JIN Date: Wed, 4 Dec 2024 14:00:36 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20!HOTFIX:=20redis=20=EB=B9=84?= =?UTF-8?q?=EC=9A=B0=EB=8A=94=20=EB=A1=9C=EC=A7=81=EC=9D=84=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=8B=A4=ED=96=89=ED=95=A0=20?= =?UTF-8?q?=EB=95=8C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-production.yml | 2 ++ BE/src/common/redis/redis.domain-service.ts | 9 ++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 8a0d90e6..fdbf07d8 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -152,6 +152,8 @@ jobs: -p 6379:6379 \ -v redis_data:/data \ redis:latest redis-server --appendonly yes + + docker exec redis redis-cli EVAL "local keys = redis.call('keys', 'connections:*') for i=1,#keys do redis.call('del', keys[i]) end" 0 fi docker pull ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }} diff --git a/BE/src/common/redis/redis.domain-service.ts b/BE/src/common/redis/redis.domain-service.ts index bf29b3e7..0e50c087 100644 --- a/BE/src/common/redis/redis.domain-service.ts +++ b/BE/src/common/redis/redis.domain-service.ts @@ -1,19 +1,14 @@ -import { Injectable, Inject, OnModuleInit } from '@nestjs/common'; +import { Injectable, Inject } from '@nestjs/common'; import Redis from 'ioredis'; @Injectable() -export class RedisDomainService implements OnModuleInit { +export class RedisDomainService { constructor( @Inject('REDIS_CLIENT') private readonly redis: Redis, @Inject('REDIS_PUBLISHER') private readonly publisher: Redis, @Inject('REDIS_SUBSCRIBER') private readonly subscriber: Redis, ) {} - async onModuleInit() { - const keys = await this.redis.keys('connections:*'); - if (keys.length > 0) await this.redis.del(keys); - } - async exists(key: string): Promise { return this.redis.exists(key); }