From 998bae3f1c3a3d39e8d1b3bca999ffc41d36c16f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Feb 2022 18:48:53 +0300 Subject: [PATCH] [#131] pool: Sign session token before caching in `newPool` Signed-off-by: Leonard Lyubich --- pool/pool.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pool/pool.go b/pool/pool.go index 1c8cf366..5603dbb2 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -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} }