forked from TrueCloudLab/neoneo-go
core: do not hold the lock while seeking over persistent store
This commit is contained in:
parent
07cbe4d253
commit
dfe2c667e1
1 changed files with 2 additions and 3 deletions
|
@ -125,6 +125,7 @@ func (s *MemCachedStore) SeekAsync(ctx context.Context, key []byte, cutPrefix bo
|
|||
})
|
||||
}
|
||||
}
|
||||
ps := s.ps
|
||||
s.mut.RUnlock()
|
||||
// Sort memRes items for further comparison with ps items.
|
||||
sort.Slice(memRes, func(i, j int) bool {
|
||||
|
@ -152,9 +153,8 @@ func (s *MemCachedStore) SeekAsync(ctx context.Context, key []byte, cutPrefix bo
|
|||
|
||||
// Seek over persistent store.
|
||||
go func() {
|
||||
s.mut.RLock()
|
||||
var done bool
|
||||
s.ps.Seek(key, func(k, v []byte) {
|
||||
ps.Seek(key, func(k, v []byte) {
|
||||
if done {
|
||||
return
|
||||
}
|
||||
|
@ -169,7 +169,6 @@ func (s *MemCachedStore) SeekAsync(ctx context.Context, key []byte, cutPrefix bo
|
|||
}
|
||||
}
|
||||
})
|
||||
s.mut.RUnlock()
|
||||
close(data2)
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in a new issue