fix: restore tenant id on cached store objects
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user