Skip to content

Commit

Permalink
add a note about node connection failure and fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed May 25, 2021
1 parent a15a617 commit b294f63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion api/allocations_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func (s *execSession) run(ctx context.Context) (exitCode int, err error) {
}

func (s *execSession) startConnection() (*websocket.Conn, error) {
nodeClient, _ := s.client.GetNodeClientWithTimeout(s.alloc.NodeID, ClientConnTimeout, s.q)
// First, attempt to connect to the node directly, but may fail due to network isolation
// and network errors. Fallback to using server-side forwarding instead.
nodeClient, err := s.client.GetNodeClientWithTimeout(s.alloc.NodeID, ClientConnTimeout, s.q)
if err == NodeDownErr {
return nil, NodeDownErr
}

q := s.q
if q == nil {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b294f63

Please sign in to comment.