Skip to content

Commit

Permalink
Fixed the race condition during create initial connection. (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
madogiwa authored Apr 1, 2021
1 parent 832e62d commit 1998548
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/renderer/lib/k8s-port-forwarding-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ WebSocketHandler.restartableHandleStandardInput = async function (createWS, stdi

// It's important to open connection immediately (even without data) for some apps (for example: mariadb)
try {
ws = await createWS()
let initialWS = await createWS()
if (!ws) {
ws = initialWS
} else {
// Connection has already been created in processData, so it should not be overwritten.
initialWS.close()
}
} catch (e) {
console.error(e)
}
Expand Down

0 comments on commit 1998548

Please sign in to comment.