Skip to content

Commit

Permalink
allowing cache for registry list calls (#41)
Browse files Browse the repository at this point in the history
Co-authored-by: Bhargav Dodla <[email protected]>
  • Loading branch information
EXPEbdodla and Bhargav Dodla authored Sep 29, 2023
1 parent 4ce821b commit aaab905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions go/internal/feast/registry/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (r *HttpRegistryStore) loadProtobufMessages(url string, messageProcessor fu
}

func (r *HttpRegistryStore) loadEntities(registry *core.Registry) error {
url := fmt.Sprintf("%s/projects/%s/entities", r.endpoint, r.project)
url := fmt.Sprintf("%s/projects/%s/entities?allow_cache=true", r.endpoint, r.project)
return r.loadProtobufMessages(url, func(data []byte) error {
entity := &core.Entity{}
if err := proto.Unmarshal(data, entity); err != nil {
Expand All @@ -128,7 +128,7 @@ func (r *HttpRegistryStore) loadEntities(registry *core.Registry) error {
}

func (r *HttpRegistryStore) loadDatasources(registry *core.Registry) error {
url := fmt.Sprintf("%s/projects/%s/data_sources", r.endpoint, r.project)
url := fmt.Sprintf("%s/projects/%s/data_sources?allow_cache=true", r.endpoint, r.project)
return r.loadProtobufMessages(url, func(data []byte) error {
data_source := &core.DataSource{}
if err := proto.Unmarshal(data, data_source); err != nil {
Expand All @@ -140,7 +140,7 @@ func (r *HttpRegistryStore) loadDatasources(registry *core.Registry) error {
}

func (r *HttpRegistryStore) loadFeatureViews(registry *core.Registry) error {
url := fmt.Sprintf("%s/projects/%s/feature_views", r.endpoint, r.project)
url := fmt.Sprintf("%s/projects/%s/feature_views?allow_cache=true", r.endpoint, r.project)
return r.loadProtobufMessages(url, func(data []byte) error {
feature_view := &core.FeatureView{}
if err := proto.Unmarshal(data, feature_view); err != nil {
Expand All @@ -152,7 +152,7 @@ func (r *HttpRegistryStore) loadFeatureViews(registry *core.Registry) error {
}

func (r *HttpRegistryStore) loadOnDemandFeatureViews(registry *core.Registry) error {
url := fmt.Sprintf("%s/projects/%s/on_demand_feature_views", r.endpoint, r.project)
url := fmt.Sprintf("%s/projects/%s/on_demand_feature_views?allow_cache=true", r.endpoint, r.project)
return r.loadProtobufMessages(url, func(data []byte) error {
od_feature_view := &core.OnDemandFeatureView{}
if err := proto.Unmarshal(data, od_feature_view); err != nil {
Expand All @@ -164,7 +164,7 @@ func (r *HttpRegistryStore) loadOnDemandFeatureViews(registry *core.Registry) er
}

func (r *HttpRegistryStore) loadFeatureServices(registry *core.Registry) error {
url := fmt.Sprintf("%s/projects/%s/feature_services", r.endpoint, r.project)
url := fmt.Sprintf("%s/projects/%s/feature_services?allow_cache=true", r.endpoint, r.project)
return r.loadProtobufMessages(url, func(data []byte) error {
feature_service := &core.FeatureService{}
if err := proto.Unmarshal(data, feature_service); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/internal/feast/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (r *Registry) InitializeRegistry() error {
_, err := r.getRegistryProto()
if err != nil {
if _, ok := r.registryStore.(*HttpRegistryStore); ok {
fmt.Println("ERROR: Registry Initialization Failed: ", err)
fmt.Printf("[%s] %s %s\n", time.UTC.String(), "ERROR: Registry Initialization Failed: ", err)
return err
}
registryProto := &core.Registry{RegistrySchemaVersion: REGISTRY_SCHEMA_VERSION}
Expand All @@ -85,7 +85,7 @@ func (r *Registry) RefreshRegistryOnInterval() {
for ; true; <-ticker.C {
err := r.refresh()
if err != nil {
fmt.Println("ERROR: Failed to refresh Registry: ", err)
fmt.Printf("[%s] %s %s\n", time.UTC.String(), "ERROR: Failed to refresh Registry: ", err)
return
}
}
Expand Down

0 comments on commit aaab905

Please sign in to comment.