Skip to content

Commit

Permalink
fix: Fix handling of TTL in Go server (#3232)
Browse files Browse the repository at this point in the history
Fix handling of TTL in Go server

According to the FeatureView docstring, 'A ttl of 0 indicates that this group of features lives forever.'
However, the Go feature server doesn't currently respect this, returning OUTSIDE_MAX_AGE for FeatureViews
that have a TTL of 0. This fixes that issue by always returning false for checkOutsideTtl if the TTL
is 0.

Signed-off-by: William Horton <william.horton@grandrounds.com>

Signed-off-by: William Horton <william.horton@grandrounds.com>
  • Loading branch information
wdhorton authored Sep 19, 2022
1 parent e117082 commit f020630
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/internal/feast/onlineserving/serving.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ func getUniqueEntityRows(joinKeysProto []*prototypes.EntityKey) ([]*prototypes.E
}

func checkOutsideTtl(featureTimestamp *timestamppb.Timestamp, currentTimestamp *timestamppb.Timestamp, ttl *durationpb.Duration) bool {
if ttl.Seconds == 0 {
return false
}
return currentTimestamp.GetSeconds()-featureTimestamp.GetSeconds() > ttl.Seconds
}

Expand Down

0 comments on commit f020630

Please sign in to comment.