Giter Club home page Giter Club logo

Comments (4)

dionjwa avatar dionjwa commented on August 18, 2024 1

It might be related to #390

from redis.

dionjwa avatar dionjwa commented on August 18, 2024 1

Yes, I am not noticing this issue anymore, this issue can be closed.

from redis.

uki00a avatar uki00a commented on August 18, 2024

Thanks for reporting the issue @dionjwa!

? do I unsubscribe here? It doesn't seem to help

No, it is not unsubscribed if it just exits the loop.

What is the correct expected pattern to subscribe->unsubscribe->subscribe again to the same key?

The following code seemed to work properly. If possible, could you share the code that is causing the problem? I would like to look into it.

import { connect } from "./redis.ts";
import { assertEquals } from "./vendor/https/deno.land/std/assert/mod.ts";

const opts = {
  hostname: "127.0.0.1",
  port: 6379
};
const redis = await connect(opts);
const pub = await connect(opts);
const channel = "foobar";
const sub = await redis.subscribe(channel);
const messages = [];
try {
  const promise = (async () => {
    for await (const m of sub.receive()) {
      messages.push(m);
      break;
    }
  })();
  await pub.publish(channel, "message");

  await promise;
  await sub.unsubscribe(channel);
  await sub.subscribe(channel);

  const promise2 = (async () => {
    for await (const m of sub.receive()) {
      messages.push(m);
      break;
    }
  })();
  await pub.publish(channel, "message 2");

  await promise2;
} finally {
  sub.close();
  redis.close();
  pub.close();
}
assertEquals(messages, [
  { channel, message: "message" },
  { channel, message: "message 2" }
]);

from redis.

uki00a avatar uki00a commented on August 18, 2024

P.S. I believe #390 has been resolved in v0.32.1. Maybe this problem has also been resolved.

from redis.

Related Issues (20)

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.