Skip to content

Commit

Permalink
Fix timer not released (#300)
Browse files Browse the repository at this point in the history
* Fix timer not released

* Update server.go
  • Loading branch information
hailin0 authored Jul 13, 2023
1 parent 0fadd20 commit aee9148
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Release Notes.

- BanyanDB ui unable to load icon.
- BanyanDB ui type error
- Fix timer not released

### Chores

Expand Down
3 changes: 3 additions & 0 deletions pkg/index/inverted/inverted.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,11 @@ func (s *store) run() {
timer := time.NewTimer(s.batchInterval)
select {
case <-s.closer.CloseNotify():
timer.Stop()
return
case event, more := <-s.ch:
if !more {
timer.Stop()
return
}
switch d := event.(type) {
Expand Down Expand Up @@ -349,6 +351,7 @@ func (s *store) run() {
case <-timer.C:
flush()
}
timer.Stop()
}
}()
}
Expand Down

0 comments on commit aee9148

Please sign in to comment.