mirror of
https://github.com/unraid/api.git
synced 2026-01-14 12:39:53 -06:00
fix: socket not sending message when readyState is 2 or 3
This commit is contained in:
@@ -269,11 +269,11 @@ export class CustomSocket {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async sendMessage(clientName: string, message?: string, timeout = 1000) {
|
||||
protected async sendMessage(clientName: 'relay' | 'internalGraphql', message?: string, timeout = 1000) {
|
||||
const client = sockets.get(clientName)?.connection;
|
||||
|
||||
try {
|
||||
if (!client || client.readyState === 0 || client.readyState === 2 || client.readyState === 3) {
|
||||
if (!client || client.readyState === 0) {
|
||||
this.logger.silly('Waiting %ss to retry sending to %s.', timeout / 1000, client?.url);
|
||||
// Wait for $timeout seconds
|
||||
await sleep(timeout);
|
||||
|
||||
Reference in New Issue
Block a user