From ae6ebccd9c12c1a5176eb6d6e7afd44a3cf81393 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 16 Aug 2022 18:54:19 +0400 Subject: [PATCH] [#1632] node/container: Don't add new container to missed cache record If container listing cache on node's side is missing (for particular owner), then updating it as a reaction to successful container creation leads to potentially invalid cache value for a period of time equivalent to cache TTL. Immediately return from `ttlContainerLister.update` method if owner's container list isn't cached. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/cache.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/neofs-node/cache.go b/cmd/neofs-node/cache.go index 7375047e25..005a6a2d0f 100644 --- a/cmd/neofs-node/cache.go +++ b/cmd/neofs-node/cache.go @@ -317,15 +317,8 @@ func (s *ttlContainerLister) update(owner user.ID, cnr cid.ID, add bool) { val, ok := (*ttlNetCache)(s).cache.Get(strOwner) if !ok { - if add { - // first cached owner's container - (*ttlNetCache)(s).set(strOwner, &cacheItemContainerList{ - list: []cid.ID{cnr}, - }, nil) - } - - // no-op on removal when no owner's containers are cached - + // we could cache the single cnr but in this case we will disperse + // with the Sidechain a lot return }