From b6abb02acec4d081f6a2c2abf0f845dd350fd749 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Feb 2022 16:45:01 +0300 Subject: [PATCH] [#130] pool: Add default session token duration Signed-off-by: Alex Vanin --- pool/pool.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pool/pool.go b/pool/pool.go index 336de1a5..a428e219 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -254,6 +254,8 @@ type innerPool struct { clientPacks []*clientPack } +const DefaultSessionTokenExpirationDuration = 100 // in blocks + func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) { cache, err := NewCache() if err != nil { @@ -301,6 +303,10 @@ 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,