mirror of
https://github.com/safing/portbase
synced 2025-09-16 18:19:50 +00:00
Fix locking in PutMany implementations
This commit is contained in:
parent
e5a72ffa37
commit
6a58ce5a7a
2 changed files with 27 additions and 22 deletions
|
@ -66,7 +66,7 @@ func (hm *HashMap) PutMany(shadowDelete bool) (chan<- record.Record, <-chan erro
|
|||
// start handler
|
||||
go func() {
|
||||
for r := range batch {
|
||||
hm.putOrDelete(shadowDelete, r)
|
||||
hm.batchPutOrDelete(shadowDelete, r)
|
||||
}
|
||||
errs <- nil
|
||||
}()
|
||||
|
@ -74,7 +74,10 @@ func (hm *HashMap) PutMany(shadowDelete bool) (chan<- record.Record, <-chan erro
|
|||
return batch, errs
|
||||
}
|
||||
|
||||
func (hm *HashMap) putOrDelete(shadowDelete bool, r record.Record) {
|
||||
func (hm *HashMap) batchPutOrDelete(shadowDelete bool, r record.Record) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
hm.dbLock.Lock()
|
||||
defer hm.dbLock.Unlock()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue