forked from TrueCloudLab/frostfs-sdk-go
[#130] pool: Add default session token duration
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
bfff21965d
commit
b6abb02ace
1 changed files with 6 additions and 0 deletions
|
@ -254,6 +254,8 @@ type innerPool struct {
|
||||||
clientPacks []*clientPack
|
clientPacks []*clientPack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DefaultSessionTokenExpirationDuration = 100 // in blocks
|
||||||
|
|
||||||
func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
|
func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
|
||||||
cache, err := NewCache()
|
cache, err := NewCache()
|
||||||
if err != nil {
|
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")
|
return nil, fmt.Errorf("at least one node must be healthy")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.SessionExpirationDuration == 0 {
|
||||||
|
options.SessionExpirationDuration = DefaultSessionTokenExpirationDuration
|
||||||
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
pool := &pool{
|
pool := &pool{
|
||||||
innerPools: inner,
|
innerPools: inner,
|
||||||
|
|
Loading…
Reference in a new issue