From 8f34663158a5ea3944312e9f85c82a223efbf3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Thu, 19 Dec 2024 13:37:48 +0100 Subject: [PATCH] new logs + remove caching for getting users --- tools/walletextension/storage/storage_with_cache.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/walletextension/storage/storage_with_cache.go b/tools/walletextension/storage/storage_with_cache.go index 8f5fca5a0..e090e534d 100644 --- a/tools/walletextension/storage/storage_with_cache.go +++ b/tools/walletextension/storage/storage_with_cache.go @@ -1,6 +1,8 @@ package storage import ( + "fmt" + "github.com/ethereum/go-ethereum/log" "github.com/ten-protocol/go-ten/go/common/viewingkey" "github.com/ten-protocol/go-ten/tools/walletextension/cache" @@ -71,19 +73,20 @@ func (s *UserStorageWithCache) RemoveSessionKey(userID []byte) error { // AddAccount adds an account to a user and invalidates the cache for the userID func (s *UserStorageWithCache) AddAccount(userID []byte, accountAddress []byte, signature []byte, signatureType viewingkey.SignatureType) error { + fmt.Println("TESTING: adding account to cosmos db for user", userID, "account", accountAddress) err := s.storage.AddAccount(userID, accountAddress, signature, signatureType) if err != nil { return err } + + fmt.Println("TESTING: account added to cosmos db for user", userID, "account", accountAddress) s.cache.Remove(userID) return nil } // GetUser retrieves a user from the cache or underlying storage func (s *UserStorageWithCache) GetUser(userID []byte) (*wecommon.GWUser, error) { - return cache.WithCache(s.cache, &cache.Cfg{Type: cache.LongLiving}, userID, func() (*wecommon.GWUser, error) { - return s.storage.GetUser(userID) - }) + return s.storage.GetUser(userID) } // GetEncryptionKey delegates to the underlying storage