From 3e9dc5ec64123dd1f2f1ed7cfc1303a351f5779e Mon Sep 17 00:00:00 2001 From: Vann-Dev Date: Tue, 2 Jan 2024 22:31:02 +0700 Subject: [PATCH] fix(redis-driver): values not returning value --- drivers/redis-driver/src/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/redis-driver/src/index.ts b/drivers/redis-driver/src/index.ts index 39d2abd..7c8b6b0 100644 --- a/drivers/redis-driver/src/index.ts +++ b/drivers/redis-driver/src/index.ts @@ -28,9 +28,16 @@ export class RedisPlayerDriver implements PlayerCacheDriver { // TODO: check if this working? public async values(clientId: string, count = 1000): Promise { - const data = await redisScan(this.redis, clientId, count); - const result: PlayerData[] = data.map(val => JSON.parse(val)); - return result; + const keys = await redisScan(this.redis, clientId, count); + const values: PlayerData[] = []; + + for (const key of keys) { + const data = await this.redis.get(key)!; + const parsedData = JSON.parse(data!) as PlayerData; + values.push(parsedData); + } + + return values; } // TODO: unlimit redis scan