mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-15 15:28:19 +00:00
ensure kv semaphore has at least 1 count (#641)
This commit is contained in:
parent
ef693175fe
commit
547ac03eeb
@ -281,7 +281,11 @@ func (opts MdbxOpts) Open() (kv.RwDB, error) {
|
||||
}
|
||||
|
||||
if opts.roTxsLimiter == nil {
|
||||
opts.roTxsLimiter = semaphore.NewWeighted(int64(runtime.GOMAXPROCS(-1)) - 1) // 1 less than max to allow unlocking to happen
|
||||
targetSemCount := int64(runtime.GOMAXPROCS(-1)) - 1
|
||||
if targetSemCount <= 1 {
|
||||
targetSemCount = 2
|
||||
}
|
||||
opts.roTxsLimiter = semaphore.NewWeighted(targetSemCount) // 1 less than max to allow unlocking to happen
|
||||
}
|
||||
db := &MdbxKV{
|
||||
opts: opts,
|
||||
|
@ -69,12 +69,17 @@ func (opts remoteOpts) WithBucketsConfig(f mdbx.TableCfgFunc) remoteOpts {
|
||||
}
|
||||
|
||||
func (opts remoteOpts) Open() (*RemoteKV, error) {
|
||||
targetSemCount := int64(runtime.GOMAXPROCS(-1)) - 1
|
||||
if targetSemCount <= 1 {
|
||||
targetSemCount = 2
|
||||
}
|
||||
|
||||
db := &RemoteKV{
|
||||
opts: opts,
|
||||
remoteKV: opts.remoteKV,
|
||||
log: log.New("remote_db", opts.DialAddress),
|
||||
buckets: kv.TableCfg{},
|
||||
roTxsLimiter: semaphore.NewWeighted(int64(runtime.GOMAXPROCS(-1)) - 1), // 1 less than max to allow unlocking
|
||||
roTxsLimiter: semaphore.NewWeighted(targetSemCount), // 1 less than max to allow unlocking
|
||||
}
|
||||
customBuckets := opts.bucketsCfg(kv.ChaindataTablesCfg)
|
||||
for name, cfg := range customBuckets { // copy map to avoid changing global variable
|
||||
|
Loading…
Reference in New Issue
Block a user