diff --git a/ccore/nebula/client_graph.go b/ccore/nebula/client_graph.go index a39a345..d6b7665 100644 --- a/ccore/nebula/client_graph.go +++ b/ccore/nebula/client_graph.go @@ -15,6 +15,7 @@ type ( Close() error Factory() Factory Version() Version + GetTimezoneInfo() types.TimezoneInfo } defaultGraphClient defaultClient @@ -34,6 +35,10 @@ func NewGraphClient(endpoints []string, username, password string, opts ...Optio return c.Graph(), nil } +func (c *defaultGraphClient) GetTimezoneInfo() types.TimezoneInfo { + return c.graph.GetTimezoneInfo() +} + func (c *defaultGraphClient) Open() error { return c.defaultClient().initDriver(func(driver types.Driver) error { return c.graph.open(driver) diff --git a/ccore/nebula/driver.go b/ccore/nebula/driver.go index ecc6b42..7022b6b 100644 --- a/ccore/nebula/driver.go +++ b/ccore/nebula/driver.go @@ -18,6 +18,7 @@ type ( username string password string sessionId int64 + timezone types.TimezoneInfo } driverMeta struct { @@ -110,8 +111,13 @@ func (d *driverGraph) open(driver types.Driver) error { return nil } +func (d *driverGraph) GetTimezoneInfo() types.TimezoneInfo { + return d.timezone +} + func (d *driverGraph) close() error { if d.GraphClientDriver != nil { + d.GraphClientDriver.Signout(d.sessionId) if err := d.GraphClientDriver.Close(); err != nil { return err } diff --git a/ccore/nebula/gateway/pool/pool.go b/ccore/nebula/gateway/pool/pool.go index 4045f1a..d4ed1c0 100644 --- a/ccore/nebula/gateway/pool/pool.go +++ b/ccore/nebula/gateway/pool/pool.go @@ -55,6 +55,7 @@ type Client struct { updateTime int64 parameterMap types.ParameterMap account *Account + timezone types.TimezoneInfo } type ClientInfo struct { @@ -239,6 +240,7 @@ func NewClient(address string, port int, username string, password string, opts username: username, password: password, }, + timezone: c.GetTimezoneInfo(), } clientPool[ncid] = client currentClientNum++ @@ -287,7 +289,6 @@ func handleRequest(ncid string) { if len(request.Gql) > 0 { // use auth response to get timezone info - authResp, err := client.graphClient.Authenticate(client.account.username, client.account.password) if err != nil { if isThriftProtoError(err) || isThriftTransportError(err) { err = fmt.Errorf("%s. %s.\n", err.Error(), InterruptError.Error()) @@ -311,7 +312,7 @@ func handleRequest(ncid string) { return } - res, err := wrapper.GenResultSet(execResponse, client.graphClient.Factory(), authResp.GetTimezoneInfo()) + res, err := wrapper.GenResultSet(execResponse, client.graphClient.Factory(), client.timezone) if err != nil { err = fmt.Errorf("%s. %s.\n", err.Error(), InterruptError.Error()) }