wait for reify workers to finish when closing
This commit is contained in:
parent
6c7ababd3f
commit
4524fbe936
@ -162,6 +162,7 @@ type SplitStore struct {
|
||||
txnSync bool
|
||||
|
||||
// background cold object reification
|
||||
reifyWorkers sync.WaitGroup
|
||||
reifyMx sync.Mutex
|
||||
reifyCond sync.Cond
|
||||
reifyPend map[cid.Cid]struct{}
|
||||
@ -707,6 +708,7 @@ func (s *SplitStore) Close() error {
|
||||
}
|
||||
|
||||
s.reifyCond.Broadcast()
|
||||
s.reifyWorkers.Wait()
|
||||
s.cancel()
|
||||
return multierr.Combine(s.markSetEnv.Close(), s.debug.Close())
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ func (s *SplitStore) reifyOrchestrator() {
|
||||
defer close(workch)
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
s.reifyWorkers.Add(1)
|
||||
go s.reifyWorker(workch)
|
||||
}
|
||||
|
||||
@ -70,6 +71,7 @@ func (s *SplitStore) reifyOrchestrator() {
|
||||
}
|
||||
|
||||
func (s *SplitStore) reifyWorker(workch chan cid.Cid) {
|
||||
defer s.reifyWorkers.Done()
|
||||
for c := range workch {
|
||||
s.doReify(c)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user