Skip to content

Commit

Permalink
Merge pull request #103 from alpacahq/fix/aggtrigger-head-tail
Browse files Browse the repository at this point in the history
aggtrigger caching fix
  • Loading branch information
rocketbitz authored Jul 6, 2018
2 parents 8c7d63b + 1f95208 commit 3a72479
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contrib/ondiskagg/aggtrigger/aggtrigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ func (s *OnDiskAggTrigger) Fire(keyPath string, records []trigger.Record) {
c := v.(*cachedAgg)

if !c.Valid(tail, head) {
glog.Infof("invalidating cache for: %v", tbk.String())

s.aggCache.Delete(tbk.String())

goto Query
Expand Down Expand Up @@ -206,7 +208,7 @@ type cachedAgg struct {
}

func (c *cachedAgg) Valid(tail, head time.Time) bool {
return tail.Equal(c.tail) && head.Equal(c.head)
return tail.Unix() >= c.tail.Unix() && head.Unix() <= c.head.Unix()
}

func (s *OnDiskAggTrigger) writeAggregates(
Expand Down

0 comments on commit 3a72479

Please sign in to comment.