Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase initial WS timeout to try to mitigate slow connection problem #1684

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"eslint-plugin-vuetify": "2.1.1",
"express": "4.18.2",
"express-ws": "5.0.2",
"graphql-ws": "5.15.0",
"istanbul-lib-coverage": "3.2.2",
"jsdom": "24.0.0",
"json-server": "0.17.4",
Expand Down
1 change: 0 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"concurrently",
"express",
"express-ws",
"graphql-ws",
"json-server",
"nodemon"
],
Expand Down
20 changes: 12 additions & 8 deletions src/graphql/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { SubscriptionClient } from 'subscriptions-transport-ws'
import { store } from '@/store/index'
import { createUrl } from '@/utils/urls'

/** @typedef {import('subscriptions-transport-ws').ClientOptions} ClientOptions */

/**
* Create the HTTP and WebSocket URLs for an ApolloClient.
*
Expand Down Expand Up @@ -64,18 +66,20 @@ export function getCylcHeaders () {
*
* @private
* @param {string} wsUrl - WebSocket subscription URL
* @param {{
* reconnect: boolean,
* lazy: boolean
* }} options - SubscriptionClient options (only two main options added here, see their doc for more)
* @param {*} wsImpl
* @param {ClientOptions} options - SubscriptionClient options
* @param {*} wsImpl - WebSocket implementation (native by default)
* @return {SubscriptionClient} a subscription client
*/
export function createSubscriptionClient (wsUrl, options = {}, wsImpl = null) {
const opts = Object.assign({
/** @type {ClientOptions} */
const opts = {
reconnect: true,
lazy: false
}, options)
lazy: false,
// Raise initial connection timeout from 1->3 secs to try to mitigate slow connection problem
// https://github.com/cylc/cylc-ui/issues/1200
minTimeout: 3e3,
...options,
}
const subscriptionClient = new SubscriptionClient(wsUrl, opts, wsImpl)
// these are the available hooks in the subscription client lifecycle
subscriptionClient.onConnecting(() => {
Expand Down
10 changes: 0 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3495,7 +3495,6 @@ __metadata:
graphiql: "npm:3.1.1"
graphql: "npm:16.8.1"
graphql-tag: "npm:2.12.6"
graphql-ws: "npm:5.15.0"
istanbul-lib-coverage: "npm:3.2.2"
jsdom: "npm:24.0.0"
json-server: "npm:0.17.4"
Expand Down Expand Up @@ -5388,15 +5387,6 @@ __metadata:
languageName: node
linkType: hard

"graphql-ws@npm:5.15.0":
version: 5.15.0
resolution: "graphql-ws@npm:5.15.0"
peerDependencies:
graphql: ">=0.11 <=16"
checksum: 10c0/4fcd93ed75261681b1def8cd96d1db0fc650586b145325b3fc134ab9c27ed48fbedad3e8261e3f3df65758a332d0420b8c60e13abb1ee8329ef624e312b61ccc
languageName: node
linkType: hard

"graphql@npm:16.8.1":
version: 16.8.1
resolution: "graphql@npm:16.8.1"
Expand Down
Loading