-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Most of the time, this code gets stuck at Promise.all. Does get not support concurrency? How to solve this?
import { Redis } from 'ioredis';
import dotenv from 'dotenv';
dotenv.config();
const main = async () => {
const keys = [
xxxxxxxxxxxx,
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
];
const client = new Redis(process.env.REDIS_RO_URL as string);
const values = await Promise.all(
keys.map(async (key) => {
console.log(`key: ${key}, client status: ${client?.status}`);
console.log(`key: ${key}, fetching cache ${JSON.stringify(client?.commandQueue)}`);
const value = await client.get(key);
console.log(`key: ${key}, fetched cache value: ${value}`);
return value;
}),
);
console.log(`fetched cache values: ${JSON.stringify(values)}`);
console.log('fetched cache values completed');
client.disconnect();
process.exit(0);
}
main();
Metadata
Metadata
Assignees
Labels
No labels