Skip to content

Commit

Permalink
[FAB-8946] Dynamic selection caching bug
Browse files Browse the repository at this point in the history
The dynamic selection PG resolver cache should
be a cache of lazy references but instead the
value is being retrieved from the reference and
the value is being cached.

Change-Id: I799dccd5ded77362e60ddc9569dbfabf0414ab8e
Signed-off-by: Bob Stasyszyn <Bob.Stasyszyn@securekey.com>
  • Loading branch information
bstasyszyn committed Mar 17, 2018
1 parent ff9763c commit 9c67a79
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -133,7 +133,7 @@ func newSelectionService(channelID string, lbp pgresolver.LoadBalancePolicy, ccP
return service.createPGResolver(key.(*resolverKey))
},
lazyref.WithAbsoluteExpiration(cacheTimeout),
).Get()
), nil
},
)

Expand Down Expand Up @@ -164,7 +164,12 @@ func (s *selectionService) getPeerGroupResolver(chaincodeIDs []string) (pgresolv
if err != nil {
return nil, err
}
return value.(pgresolver.PeerGroupResolver), nil
lazyRef := value.(*lazyref.Reference)
resolver, err := lazyRef.Get()
if err != nil {
return nil, err
}
return resolver.(pgresolver.PeerGroupResolver), nil
}

func (s *selectionService) createPGResolver(key *resolverKey) (pgresolver.PeerGroupResolver, error) {
Expand Down

0 comments on commit 9c67a79

Please sign in to comment.