-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
The "multi" function does not work with long strings. When adding commands with long strings, the promise will never end.
In this example, only one command will be executed.
import { createClient } from 'redis';
import fetch from 'node-fetch';
const getHtmlText = async (url) => {
const res = await fetch(url);
const text = res.text();
return text;
};
(async () => {
const client = createClient();
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
const text = await getHtmlText('https://google.com');
const commands = Array.from(Array(2).keys()).map((n) => (['set', `test:${n}`, text]));
const multi = await client.multi();
commands.forEach((command) => {
multi.addCommand(command);
});
const results = await multi.execAsPipeline();
})()
.then(() => {
console.log('DONE')
})
.catch(console.error);
Environment:
- Node.js Version: v16.2.0
- Redis Server Version: 6.2.5
- Node Redis Version: 4.0.0-rc.2
- Platform: Manjaro