-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Resubscribe for sub client hangs awaiting Promise.all(promises) in the following part of source code
const resubscribePromise = this.#queue.resubscribe();
if (resubscribePromise) {
promises.push(resubscribePromise);
}
if (promises.length) {
this.#tick(true);
await Promise.all(promises);
}
Here's the test code for this:
import {createClient} from "./packages/client";
const pubClient = createClient({
url: `redis://127.0.0.1:6379`,
socket: { connectTimeout: 1000 },
})
const subClient = pubClient.duplicate();
pubClient.on('error', (error: Error) => console.error(error));
subClient.on('error', (error: Error) => console.error(error));
pubClient.on('connect', () => console.log('pubClient connected and starting initiator'));
pubClient.on('ready', () => console.log('pubClient is ready'));
subClient.on('connect', () => console.log('subClient connected and starting initiator'));
subClient.on('ready', () => console.log('subClient is ready'));
(async () => {
await pubClient.connect();
await subClient.connect();
subClient.subscribe('some-key', () => {
console.log('Received');
});
setInterval(() => {
pubClient.publish('some-key', 'data');
console.log('Sent');
}, 10 * 1000)
})()
So I just run the test script and restart docker container.
Environment:
- Node.js Version: 12.22.7
- Redis Server Version: 6.2.6
- Node Redis Version: 4.0.0
- Platform: MacOS
anteyk