From ac66db59e0b0c6e15d36da1f1210d1fe7fc76f96 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Feb 2022 15:59:31 +0300 Subject: [PATCH] [#130] pool: Set default session token lifetime before initial requests Signed-off-by: Alex Vanin --- pool/pool.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index a428e219..b1bf97f1 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -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,