1
0
Fork 0
mirror of synced 2024-09-06 12:41:24 +12:00

Fix types

This commit is contained in:
Adria Navarro 2023-09-19 13:27:42 +02:00
parent 1d63b219b8
commit e128f1c921
2 changed files with 3 additions and 3 deletions

View file

@ -120,7 +120,7 @@ export async function getUsers(
): Promise<{ users: User[]; notFoundIds?: string[] }> { ): Promise<{ users: User[]; notFoundIds?: string[] }> {
const client = await redis.getUserClient() const client = await redis.getUserClient()
// try cache // try cache
let usersFromCache = await client.bulkGet<User>(userIds) let usersFromCache = await client.bulkGet(userIds)
const missingUsersFromCache = userIds.filter(uid => !usersFromCache[uid]) const missingUsersFromCache = userIds.filter(uid => !usersFromCache[uid])
const users = Object.values(usersFromCache) const users = Object.values(usersFromCache)
let notFoundIds let notFoundIds

View file

@ -242,7 +242,7 @@ class RedisWrapper {
} }
} }
async bulkGet<T>(keys: string[]) { async bulkGet(keys: string[]) {
const db = this._db const db = this._db
if (keys.length === 0) { if (keys.length === 0) {
return {} return {}
@ -250,7 +250,7 @@ class RedisWrapper {
const prefixedKeys = keys.map(key => addDbPrefix(db, key)) const prefixedKeys = keys.map(key => addDbPrefix(db, key))
let response = await this.getClient().mget(prefixedKeys) let response = await this.getClient().mget(prefixedKeys)
if (Array.isArray(response)) { if (Array.isArray(response)) {
let final: any = {} let final: Record<string, any> = {}
let count = 0 let count = 0
for (let result of response) { for (let result of response) {
if (result) { if (result) {