Skip to content

The "Multi" function does not work with long strings #1676

@slava-viktorov

Description

@slava-viktorov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions