Skip to content

Commit

Permalink
previous should have the same config as the other two BF
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Oct 22, 2022
1 parent c5c9ea0 commit ab56425
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions rotate/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func New(ctx context.Context, cfg Config) *Bloomfilter {
prevCfg := bloomfilter.EmptyConfig
prevCfg.HashName = cfg.HashName
r := &Bloomfilter{
Previous: bbloomfilter.New(prevCfg),
// Previous: bbloomfilter.New(prevCfg),
Previous: bbloomfilter.New(cfg.Config),
Current: bbloomfilter.New(cfg.Config),
Next: bbloomfilter.New(cfg.Config),
Config: cfg,
Expand Down Expand Up @@ -96,10 +97,6 @@ func (bs *Bloomfilter) Union(that interface{}) (float64, error) {
return bs.capacity(), fmt.Errorf("error: diferrent p values %.2f vs. %.2f", other.Config.P, bs.Config.P)
}

if _, err := bs.Previous.Union(other.Previous); err != nil {
return bs.capacity(), err
}

if _, err := bs.Current.Union(other.Current); err != nil {
return bs.capacity(), err
}
Expand All @@ -108,7 +105,8 @@ func (bs *Bloomfilter) Union(that interface{}) (float64, error) {
return bs.capacity(), err
}

return bs.capacity(), nil
_, err := bs.Previous.Union(other.Previous)
return bs.capacity(), err
}

func (bs *Bloomfilter) keepRotating(ctx context.Context, c <-chan time.Time) {
Expand Down

0 comments on commit ab56425

Please sign in to comment.