Skip to content

Commit

Permalink
fix: graphd service timeout (#386)
Browse files Browse the repository at this point in the history
* fix: graphd service timeout

(cherry picked from commit 39571fe)

* Update comment
  • Loading branch information
huaxiabuluo authored Dec 12, 2022
1 parent ffefb5b commit 7dc1b45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 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 @@ -108,8 +111,8 @@ 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))
// set Graph Service connect timeout 8h, which is 0s default(means no timeout)
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 7dc1b45

Please sign in to comment.