Closed yuvalsus-esggo closed 1 year ago
Hi! The error is thrown there: https://github.com/socketio/socket.io-postgres-adapter/blob/4190f4b571cfe29c3db70c68a8250817251effd0/lib/index.ts#L711-L715
You should be able to catch it though:
try {
const sockets = await io.fetchSockets();
} catch (e) {
// something went wrong
}
Isn't that the case?
Thanks for the fast response! I've added a try-catch and it still crashes the server
`const sockets = await this.server.fetchSockets();
sockets.forEach(socket => {
if (
socket?.data?.registrations &&
_.find(
socket.data.registrations,
(registration: string) => registration === generateIndicatorId(indicatorId, relevanceTime, organizationId)
)
) {
socket.emit("update", indicator);
}
});`
Hmm, I'm not able to reproduce: https://github.com/socketio/socket.io-fiddle/tree/postgres-adapter
The exception is properly caught and printed to the console:
try {
const sockets = await io.fetchSockets();
socket.emit("count", sockets.length);
} catch (e) {
console.log(e); // prints "Error: timeout reached: only 0 responses received out of 1 [...]"
}
});
Could you please check?
Closed due to inactivity, please reopen if needed.
Hey there,
We are currently facing an issue with fetchSockets() in a Nest.js backend using @socket.io/postgres-adapter. When one server connected to the database disconnects it throws an error and crashes the server.
Error: timeout reached: only 0 responses received out of 1
We are running on AWS rds-postgres. When two se
We are pretty lost currently when it comes to ideas where to debug and how to fix this issue, therefore we're asking here. We believe this is either a problem with the postgres adapter or with socket.io itself (thus my next question: does this issue belong in this repository or should we open another issue in the socket.io repo?).
Thanks a lot for your help!
Relevant versions in use @nestjs/platform-socket.io@8.4.4 socket.io@4.5.2 @socket.io/postgres-adapter@0.3.0