enisdenjo / graphql-ws

Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
https://the-guild.dev/graphql/ws
MIT License
1.75k stars 162 forks source link

On Normal Closure the app doesn't retry even when shouldRetry set to true #446

Closed OttlikG closed 1 year ago

OttlikG commented 1 year ago

Screenshot

218757654-5f46e4c6-a05e-4a13-9079-552ca45502ea

Expected Behaviour I'm expecting the connection return to normal after the server drops cause of restart.

Actual Behaviour I set the following options:

{
  shouldRetry: () => true,
  retryAttempts: 50,
}

to createClient but the retry mechanism doesn't kicks in. As I see the process doesn't get to shouldRetryConnectOrThrow so the shouldRetry configuration doesn't get called.

Debug Information I run Hasura graphql server which throws the following error on Kubernetes pod restart.

[
    {
        "extensions": {
            "path": "$",
            "code": "postgres-error"
        },
        "message": "connection error"
    }
]

The socket.onclose function gets called when server restarts without the retry functionality. The event type is Normal Closure.

If any more information is needed, let me know.