Probably ought to wrap this in a mutex. Index can be set, potentially multiple times if done concurrently, before the observable finished updating:
|
err = idx.db.Set([]byte(addr), raw) |
|
if err != nil { |
|
return fmt.Errorf("error in store:%w", err) |
|
} |
|
|
|
idx.l.Lock() |
|
defer idx.l.Unlock() |
|
|
|
obv, ok := idx.obvs[addr] |
|
if ok { |
|
err = obv.Set(v) |
|
if err != nil { |
|
return fmt.Errorf("error setting value in observable:%w", err) |
|
} |
|
} |
Probably ought to wrap this in a mutex. Index can be set, potentially multiple times if done concurrently, before the observable finished updating:
margaret/indexes/mkv/index.go
Lines 114 to 128 in 22ed48a