Skip to content

Commit

Permalink
enable session active when calling close()
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jbahk committed Mar 11, 2021
1 parent 8dbd9b2 commit 6d4a132
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ func (sc *snowflakeConn) Close() (err error) {
logger.WithContext(sc.ctx).Infoln("Close")
sc.stopHeartBeat()

err = sc.rest.FuncCloseSession(sc.ctx, sc.rest, sc.rest.RequestTimeout)
if err != nil {
logger.Error(err)
if !sc.cfg.KeepSessionAlive {
err = sc.rest.FuncCloseSession(context.TODO(), sc.rest, sc.rest.RequestTimeout)
if err != nil {
logger.Error(err)
}
}
sc.cleanup()
return nil
Expand Down
5 changes: 3 additions & 2 deletions dsn.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ type Config struct {
InsecureMode bool // driver doesn't check certificate revocation status
OCSPFailOpen OCSPFailOpenMode // OCSP Fail Open

Token string // Token to use for OAuth other forms of token based auth
TokenAccessor TokenAccessor // Optional token accessor to use
Token string // Token to use for OAuth other forms of token based auth
TokenAccessor TokenAccessor // Optional token accessor to use
KeepSessionAlive bool // Enables the session to persist even after the connection is closed

PrivateKey *rsa.PrivateKey // Private key used to sign JWT

Expand Down

0 comments on commit 6d4a132

Please sign in to comment.