[#130] pool: Add default session token duration

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
remotes/KirillovDenis/feature/137-monitoring_grpc_channel
Alex Vanin 2022-02-02 16:45:01 +03:00 committed by Angira Kekteeva
parent bfff21965d
commit b6abb02ace
1 changed files with 6 additions and 0 deletions

View File

@ -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,