Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix registry proto #2435

Merged
merged 7 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions go/internal/feast/featurestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,17 @@ func (fs *FeatureStore) listFeatureViews(hideDummyEntity bool) ([]*FeatureView,
if err != nil {
return featureViews, err
}
for _, featureView := range featureViews {
if _, ok := featureView.entities[DUMMY_ENTITY_NAME]; ok && hideDummyEntity {
featureView.entities = make(map[string]struct{})
}
}
return featureViews, nil
}

func (fs *FeatureStore) listRequestFeatureViews() ([]*RequestFeatureView, error) {
requestFeatureViews, err := fs.registry.listRequestFeatureViews(fs.config.Project)
if err != nil {
return requestFeatureViews, err
}
return requestFeatureViews, nil
}

func (fs *FeatureStore) listEntities(hideDummyEntity bool) ([]*Entity, error) {

allEntities, err := fs.registry.listEntities(fs.config.Project)
Expand Down
24 changes: 12 additions & 12 deletions go/internal/feast/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ var REGISTRY_STORE_CLASS_FOR_SCHEME map[string]string = map[string]string{
*/

type Registry struct {
registryStore RegistryStore
cachedFeatureServices map[string]map[string]*core.FeatureService
cachedEntities map[string]map[string]*core.Entity
cachedFeatureViews map[string]map[string]*core.FeatureView
cachedOnDemandFeatureViews map[string]map[string]*core.OnDemandFeatureView
cachedRequestFeatureViews map[string]map[string]*core.RequestFeatureView
cachedRegistry *core.Registry
cachedRegistryProtoCreated time.Time
cachedRegistryProtoTtl time.Duration
mu sync.Mutex
registryStore RegistryStore
cachedFeatureServices map[string]map[string]*core.FeatureService
cachedEntities map[string]map[string]*core.Entity
cachedFeatureViews map[string]map[string]*core.FeatureView
cachedOnDemandFeatureViews map[string]map[string]*core.OnDemandFeatureView
cachedRequestFeatureViews map[string]map[string]*core.RequestFeatureView
cachedRegistry *core.Registry
cachedRegistryProtoLastUpdated time.Time
cachedRegistryProtoTtl time.Duration
mu sync.Mutex
}

func NewRegistry(registryConfig *RegistryConfig, repoPath string) (*Registry, error) {
Expand Down Expand Up @@ -86,7 +86,7 @@ func (r *Registry) refresh() error {
}

func (r *Registry) getRegistryProto() (*core.Registry, error) {
expired := r.cachedRegistry == nil || (r.cachedRegistryProtoTtl > 0 && time.Now().After(r.cachedRegistryProtoCreated.Add(r.cachedRegistryProtoTtl)))
expired := r.cachedRegistry == nil || (r.cachedRegistryProtoTtl > 0 && time.Now().After(r.cachedRegistryProtoLastUpdated.Add(r.cachedRegistryProtoTtl)))
if !expired {
return r.cachedRegistry, nil
}
Expand All @@ -112,7 +112,7 @@ func (r *Registry) load(registry *core.Registry) {
r.loadFeatureViews(registry)
r.loadOnDemandFeatureViews(registry)
r.loadRequestFeatureViews(registry)
r.cachedRegistryProtoCreated = time.Now()
r.cachedRegistryProtoLastUpdated = time.Now()
}

func (r *Registry) loadEntities(registry *core.Registry) {
Expand Down