Skip to content

Commit

Permalink
πŸš‘ !HOTFIX: redis λΉ„μš°λŠ” λ‘œμ§μ„ 슀크립트 μ‹€ν–‰ν•  λ•Œλ‘œ λ³€κ²½
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuo3o committed Dec 4, 2024
1 parent bd49b77 commit 466556f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
9 changes: 2 additions & 7 deletions BE/src/common/redis/redis.domain-service.ts
Original file line number Diff line number Diff line change
@@ -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<number> {
return this.redis.exists(key);
}
Expand Down

0 comments on commit 466556f

Please sign in to comment.