From 9cd7ef78276abf233b637cf590aa2983c63b539c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 19 Sep 2023 10:30:45 +0200 Subject: [PATCH] Typing redis --- packages/backend-core/src/cache/user.ts | 2 +- packages/backend-core/src/redis/redis.ts | 4 ++-- packages/server/src/websockets/websocket.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend-core/src/cache/user.ts b/packages/backend-core/src/cache/user.ts index b3fd7c08cd..481d3691e4 100644 --- a/packages/backend-core/src/cache/user.ts +++ b/packages/backend-core/src/cache/user.ts @@ -120,7 +120,7 @@ export async function getUsers( ): Promise<{ users: User[]; notFoundIds?: string[] }> { const client = await redis.getUserClient() // try cache - let usersFromCache = await client.bulkGet(userIds) + let usersFromCache = await client.bulkGet(userIds) const missingUsersFromCache = userIds.filter(uid => !usersFromCache[uid]) const users = Object.values(usersFromCache) let notFoundIds diff --git a/packages/backend-core/src/redis/redis.ts b/packages/backend-core/src/redis/redis.ts index 78817d0aa0..e7755f275d 100644 --- a/packages/backend-core/src/redis/redis.ts +++ b/packages/backend-core/src/redis/redis.ts @@ -242,7 +242,7 @@ class RedisWrapper { } } - async bulkGet(keys: string[]) { + async bulkGet(keys: string[]) { const db = this._db if (keys.length === 0) { return {} @@ -250,7 +250,7 @@ class RedisWrapper { const prefixedKeys = keys.map(key => addDbPrefix(db, key)) let response = await this.getClient().mget(prefixedKeys) if (Array.isArray(response)) { - let final: Record = {} + let final: Record = {} let count = 0 for (let result of response) { if (result) { diff --git a/packages/server/src/websockets/websocket.ts b/packages/server/src/websockets/websocket.ts index c92f0b6897..ffaf9e2763 100644 --- a/packages/server/src/websockets/websocket.ts +++ b/packages/server/src/websockets/websocket.ts @@ -150,7 +150,7 @@ export class BaseSocket { if (room) { const sessionIds = await this.getRoomSessionIds(room) const keys = sessionIds.map(this.getSessionKey.bind(this)) - const sessions = await this.redisClient?.bulkGet(keys) + const sessions = await this.redisClient?.bulkGet(keys) return Object.values(sessions || {}) } else { return []