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

fix: graphd connection timeout #383

Merged
merged 1 commit into from
Dec 8, 2022
Merged
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
7 changes: 5 additions & 2 deletions server/api/studio/pkg/auth/authorize.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ type (
}
)

var GraphServiceConnectTimeout = 5 * time.Second
// set the timeout for the graph service: 8 hours
// once the timeout is reached, the connection will be closed
// all requests running ngql will be failed, so keepping a long timeout is necessary, make the connection alive
const GraphServiceTimeout = 8 * time.Hour

func CreateToken(authData *AuthData, config *config.Config) (string, error) {
now := time.Now()
Expand Down Expand Up @@ -109,7 +112,7 @@ func ParseConnectDBParams(params *types.ConnectDBParams, config *config.Config)

username, password := loginInfo[0], loginInfo[1]
// set Graph Service connect timeout 5s, which is 0s default(means no timeout)
clientInfo, err := dao.Connect(params.Address, params.Port, username, password, nebula.WithGraphTimeout(GraphServiceConnectTimeout))
clientInfo, err := dao.Connect(params.Address, params.Port, username, password, nebula.WithGraphTimeout(GraphServiceTimeout))
if err != nil {
return "", nil, err
}
Expand Down