some tweaks in badger markset

This commit is contained in:
vyzo 2021-07-22 15:24:30 +03:00
parent f492f8d450
commit 4df6073382

View File

@ -34,7 +34,7 @@ type BadgerMarkSet struct {
var _ MarkSet = (*BadgerMarkSet)(nil) var _ MarkSet = (*BadgerMarkSet)(nil)
var badgerMarkSetBatchSize = 65536 var badgerMarkSetBatchSize = 16384
func NewBadgerMarkSetEnv(path string) (MarkSetEnv, error) { func NewBadgerMarkSetEnv(path string) (MarkSetEnv, error) {
msPath := filepath.Join(path, "markset.badger") msPath := filepath.Join(path, "markset.badger")
@ -113,13 +113,13 @@ func (s *BadgerMarkSet) Mark(c cid.Cid) error {
defer func() { defer func() {
s.mx.Lock() s.mx.Lock()
defer s.mx.Unlock()
delete(s.writing, seqno) delete(s.writing, seqno)
s.writers-- s.writers--
if s.writers == 0 { if s.writers == 0 {
s.cond.Broadcast() s.cond.Broadcast()
} }
s.mx.Unlock()
}() }()
empty := []byte{} // not nil empty := []byte{} // not nil