From 09b15da3cb005f87760631db5a9886a90a898131 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 14 Jan 2026 03:52:22 -0800 Subject: [PATCH] =?UTF-8?q?fix(mining-service):=20Redis=E9=94=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=AF=AB=E7=A7=92PX=E4=BB=A3=E6=9B=BF=E7=A7=92EX?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B0=8F=E6=95=B0TTL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mining-service/src/infrastructure/redis/redis.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/services/mining-service/src/infrastructure/redis/redis.service.ts b/backend/services/mining-service/src/infrastructure/redis/redis.service.ts index bf395c69..1331db79 100644 --- a/backend/services/mining-service/src/infrastructure/redis/redis.service.ts +++ b/backend/services/mining-service/src/infrastructure/redis/redis.service.ts @@ -64,7 +64,8 @@ export class RedisService implements OnModuleInit, OnModuleDestroy { async acquireLock(lockKey: string, ttlSeconds: number = 30): Promise { const lockValue = `${Date.now()}-${Math.random().toString(36).substring(7)}`; - const result = await this.client.set(lockKey, lockValue, 'EX', ttlSeconds, 'NX'); + const ttlMs = Math.round(ttlSeconds * 1000); + const result = await this.client.set(lockKey, lockValue, 'PX', ttlMs, 'NX'); return result === 'OK' ? lockValue : null; }