Skip to content

Commit

Permalink
fix: graphd service timeout (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
huaxiabuluo authored Dec 8, 2022
1 parent ec43b20 commit f0172eb
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit f0172eb

Please sign in to comment.