[#131] pool: Sign session token before caching in newPool

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-17 18:48:53 +03:00 committed by LeL
parent d889ab3022
commit 998bae3f1c

View file

@ -290,7 +290,11 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
} else if err == nil {
healthy, atLeastOneHealthy = true, true
st := sessionTokenForOwner(ownerID, cliRes)
_ = cache.Put(formCacheKey(addr, options.Key), st)
// sign the session token and cache it on success
if err = st.Sign(options.Key); err == nil {
_ = cache.Put(formCacheKey(addr, options.Key), st)
}
}
clientPacks[j] = &clientPack{client: c, healthy: healthy, address: addr}
}