Skip to content

Commit

Permalink
pkg/receive/multitsdb.go: Remove unused Close method
Browse files Browse the repository at this point in the history
TSDBs are implicitly closed by flushing the database, which is ensured
on shutdown, hence there is no need to have the explicit close method.

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
  • Loading branch information
brancz committed Apr 14, 2020
1 parent b691fd0 commit 47dc82a
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions pkg/receive/multitsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,34 +142,6 @@ func (t *MultiTSDB) Open() error {
return g.Wait()
}

func (t *MultiTSDB) Close() error {
t.mtx.Lock()
defer t.mtx.Unlock()

errmtx := &sync.Mutex{}
merr := terrors.MultiError{}
wg := &sync.WaitGroup{}
for _, tenant := range t.tenants {
s := tenant.flushableStorage()
if s == nil {
continue
}

wg.Add(1)
go func() {
if err := s.Close(); err != nil {
errmtx.Lock()
merr.Add(err)
errmtx.Unlock()
}
wg.Done()
}()
}

wg.Wait()
return merr.Err()
}

func (t *MultiTSDB) Flush() error {
t.mtx.Lock()
defer t.mtx.Unlock()
Expand Down

0 comments on commit 47dc82a

Please sign in to comment.