Skip to content

Commit ca613b2

Browse files
committed
[FAB-14324] move validation semaphore to instance
Change-Id: I033442b282e5f223a3f29d1061634edfe120b35f Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent 6c09ad3 commit ca613b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/peer/peer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ func MockSetMSPIDGetter(mspIDGetter func(string) []string) {
169169
mockMSPIDGetter = mspIDGetter
170170
}
171171

172-
// validationWorkersSemaphore is the semaphore used to ensure that
173-
// there are not too many concurrent tx validation goroutines
174-
var validationWorkersSemaphore semaphore.Semaphore
175-
176172
func getCurrConfigBlockFromLedger(ledger ledger.PeerLedger) (*common.Block, error) {
177173
peerLogger.Debugf("Getting config block")
178174

@@ -424,6 +420,10 @@ type Peer struct {
424420
StoreProvider transientstore.StoreProvider
425421
storesMutex sync.RWMutex
426422
stores map[string]transientstore.Store
423+
424+
// validationWorkersSemaphore is used to limit the number of concurrent validation
425+
// go routines.
426+
validationWorkersSemaphore semaphore.Semaphore
427427
}
428428

429429
// Default provides in implementation of the Peer interface that provides
@@ -584,7 +584,7 @@ func (p *Peer) createChain(
584584

585585
validator := txvalidator.NewTxValidator(
586586
cid,
587-
validationWorkersSemaphore,
587+
p.validationWorkersSemaphore,
588588
cs,
589589
&vir.ValidationInfoRetrieveShim{
590590
New: newLifecycleValidation,
@@ -816,7 +816,7 @@ func (p *Peer) Initialize(
816816
nWorkers int,
817817
txProcessors customtx.Processors,
818818
) {
819-
validationWorkersSemaphore = semaphore.New(nWorkers)
819+
p.validationWorkersSemaphore = semaphore.New(nWorkers)
820820

821821
pluginMapper = pm
822822
chainInitializer = init

0 commit comments

Comments
 (0)