Skip to content

Commit

Permalink
Fix tolerating stale data in properties service (#4478)
Browse files Browse the repository at this point in the history
The condition was wrong... This makes it so that data is marked as valid
if the time-range is fine or if we can tolerate it.

Signed-off-by: Juan Antonio Osorio <[email protected]>
  • Loading branch information
JAORMX authored Sep 13, 2024
1 parent 944ac39 commit 6829aa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/entities/properties/service/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ func (ps *propertiesService) areDatabasePropertiesValid(

func (ps *propertiesService) isDatabasePropertyValid(
dbProp db.Property, opts *ReadOptions) bool {
if ps.entityTimeout == bypassCacheTimeout || opts.canTolerateStaleData() {
if ps.entityTimeout == bypassCacheTimeout {
return false
}
return time.Since(dbProp.UpdatedAt) < ps.entityTimeout
return time.Since(dbProp.UpdatedAt) < ps.entityTimeout || opts.canTolerateStaleData()
}

0 comments on commit 6829aa5

Please sign in to comment.