[#130] pool: Set default session token lifetime before initial requests

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-02-10 15:59:31 +03:00 committed by Alex Vanin
parent b6abb02ace
commit ac66db59e0

View file

@ -262,6 +262,10 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
return nil, fmt.Errorf("couldn't create cache: %w", err)
}
if options.SessionExpirationDuration == 0 {
options.SessionExpirationDuration = DefaultSessionTokenExpirationDuration
}
ownerID := owner.NewIDFromPublicKey(&options.Key.PublicKey)
inner := make([]*innerPool, len(options.nodesParams))
@ -303,10 +307,6 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
return nil, fmt.Errorf("at least one node must be healthy")
}
if options.SessionExpirationDuration == 0 {
options.SessionExpirationDuration = DefaultSessionTokenExpirationDuration
}
ctx, cancel := context.WithCancel(ctx)
pool := &pool{
innerPools: inner,