Skip to content

Commit

Permalink
fix(redis-driver): values not returning value
Browse files Browse the repository at this point in the history
  • Loading branch information
Vann-Dev committed Jan 2, 2024
1 parent 6b99281 commit 3e9dc5e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/redis-driver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ export class RedisPlayerDriver implements PlayerCacheDriver {

// TODO: check if this working?
public async values(clientId: string, count = 1000): Promise<PlayerData[]> {
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
Expand Down

0 comments on commit 3e9dc5e

Please sign in to comment.