From 58cce46dee22c5670c0e88f1f33f04d091f39f22 Mon Sep 17 00:00:00 2001 From: richjohnrambo Date: Tue, 25 Aug 2026 23:20:19 +0800 Subject: [PATCH] fix: restore tenant id on cached store objects --- server/store/store.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/store/store.go b/server/store/store.go index 869787d..29b1552 100644 --- a/server/store/store.go +++ b/server/store/store.go @@ -645,6 +645,9 @@ func (usersMapper) Get(tenantID types.TenantID, uid types.Uid) (*types.User, err if ok, err := GetCachedObject(tenantID, cacheNamespaceUser, uid.String(), &cached); err != nil { logs.Warn.Printf("cache user[%s]: read failed: %v", uid.UserId(), err) } else if ok { + if cached.TenantID == types.ZeroTenantID { + cached.TenantID = tenantID + } if cached.TenantID != tenantID { return nil, types.ErrNotFound } @@ -1033,6 +1036,9 @@ func (topicsMapper) Get(tenantID types.TenantID, topic string) (*types.Topic, er if ok, err := GetCachedObject(tenantID, cacheNamespaceTopic, topic, &cached); err != nil { logs.Warn.Printf("cache topic[%s]: read failed: %v", topic, err) } else if ok { + if cached.TenantID == types.ZeroTenantID { + cached.TenantID = tenantID + } if cached.TenantID != tenantID { return nil, types.ErrNotFound } @@ -1197,6 +1203,9 @@ func (subsMapper) Get(tenantID types.TenantID, topic string, user types.Uid, kee if ok, err := GetCachedObject(tenantID, cacheNamespaceSub, cacheID, &cached); err != nil { logs.Warn.Printf("cache sub[%s]: read failed: %v", cacheID, err) } else if ok { + if cached.TenantID == types.ZeroTenantID { + cached.TenantID = tenantID + } if cached.TenantID != tenantID { return nil, types.ErrNotFound }