Giter VIP home page Giter VIP logo

r2d2's People

Contributors

dependabot[bot] avatar iuioiua avatar web-flow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

r2d2's Issues

Large texts are split/chunked?

I have values of about 100kb each, but they're split and or not saved/read properly.

Any idea what the issue can be? Does the TCP buffer size need to be increased?

I check the Deno docs about the Deno.connect but it doesn't mention anything about this.

idea: demo

This module should have a really dope demo that shows how fast this module is. This could probably be achieved with an extensive yet interesting dataset and a simple "live" search bar and using RediSearch. I'm open to ideas. One could start looking at this directory of Redis datasets.

publish to JSR

would you consider publishing to JSR for this package?

Race conditions on sendCommand.

Was confused why connections would stall/hang when reading many keys async.

It's because when using 1 connection, redis needs a queue.

As you can see in the older driver here:
https://github.com/search?q=repo%3Adenodrivers%2Fredis%20queue&type=code

Something like this maybe (untested):

// Command queue
const commandQueue: Command[] = [];
let isProcessingQueue = false;

// Function to process command queue
async function processQueue(redisConn: Deno.Conn) {
  if (isProcessingQueue) return;
  isProcessingQueue = true;

  while (commandQueue.length > 0) {
    const command = commandQueue.shift();
    if (command) {
      try {
        await writeCommand(redisConn, command);
        const reply = await readReply(readDelim(redisConn, CRLF_RAW));
        console.log(reply); // handle reply as needed
      } catch (error) {
        console.error(error); // handle error as needed
      }
    }
  }

  isProcessingQueue = false;
}

// Updated sendCommand to use command queue
export async function sendCommand(
  redisConn: Deno.Conn,
  command: Command,
  raw = false,
): Promise<void> {
  commandQueue.push(command);
  processQueue(redisConn);
}

todo: move to Web Streams API

This module currently uses Deno's Reader and Writer interfaces. These interfaces are slowly being phased out, along with functions within the Standard Library that rely on these interfaces, such as writeAll() and readDelim(), which are deprecated.

We must move to using the Web Streams API as simply as possible.

Feature: Connection pools

Since Redis itself is a serial protocol, we're limited to 1 command at a time, having a connection pool would solve this issue and drastically improve performance (Especially on multi-threaded redis like KeyDB).

I suggest a number by default to open multiple connections to the same port and an array of connections for custom hosts and ports (ex. for clusters).

Unable to reconnect after broken pipe

The current implementation breaks if redis is restarted due to broken pipe causing a panic/throw.

Reconnecting with exponential back-off would be extremely helpful, with the new queue in place no work would be lost either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.