[#131] pool: Limit session lifetime in openDefaultSession
method
Call `createSessionTokenForDuration` function for session opening in `pool.openDefaultSession` method in order to limit session lifetime according to pool configuration (`SessionExpirationDuration`). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
28b49419ab
commit
1130c1f5a6
1 changed files with 2 additions and 6 deletions
|
@ -608,7 +608,7 @@ func (p *pool) initCallContext(ctx *callContext, cfg *callConfig) error {
|
|||
ctx.endpoint = cp.address
|
||||
ctx.client = cp.client
|
||||
|
||||
if ctx.sessionTarget == nil && cfg.stoken != nil {
|
||||
if ctx.sessionTarget != nil && cfg.stoken != nil {
|
||||
ctx.sessionTarget(*cfg.stoken)
|
||||
}
|
||||
|
||||
|
@ -649,11 +649,7 @@ func (p *pool) openDefaultSession(ctx *callContext) error {
|
|||
}
|
||||
|
||||
// open new session
|
||||
var cliPrm client.CreateSessionPrm
|
||||
|
||||
cliPrm.SetExp(math.MaxUint32)
|
||||
|
||||
cliRes, err := ctx.client.CreateSession(ctx, cliPrm)
|
||||
cliRes, err := createSessionTokenForDuration(ctx, ctx.client, p.stokenDuration)
|
||||
if err != nil {
|
||||
return fmt.Errorf("session API client: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue