Commit 6d07ee07 authored by Gari Singh's avatar Gari Singh Committed by Gerrit Code Review
Browse files

Merge changes Ic3979ddb,Ie599c0d4

* changes:
  [FAB-10954] data race core/comm/producer
  [FAB-9160] fix data race in TestRecoverFromError
parents 86e0a0aa 9dcaed64
......@@ -100,7 +100,6 @@ func TestUpdateEndpoints(t *testing.T) {
}
func TestDisableEndpoint(t *testing.T) {
t.Parallel()
orgEndpointDisableInterval := EndpointDisableInterval
EndpointDisableInterval = time.Millisecond * 100
defer func() { EndpointDisableInterval = orgEndpointDisableInterval }()
......
......@@ -291,18 +291,19 @@ func TestRecoverFromError(t *testing.T) {
}
defer close(support.BlockCutterVal.Block)
bs := newChain(support)
_ = goWithWait(bs.main)
go bs.main()
defer bs.Halt()
support.BlockCutterVal.SkipAppendCurBatch = true
syncQueueMessage(testMessage, bs, support.BlockCutterVal)
support.BlockCutterVal.CurBatch = nil
select {
case <-support.Blocks:
t.Fatalf("Expected no invocations of Append")
case <-time.After(2 * time.Millisecond):
case <-time.After(100 * time.Millisecond):
}
support.BlockCutterVal.SkipAppendCurBatch = false
support.BlockCutterVal.CutNext = true
syncQueueMessage(testMessage, bs, support.BlockCutterVal)
select {
......
......@@ -41,6 +41,9 @@ type Receiver struct {
// CutNext causes Ordered returns [][]{append(curBatch, newTx)}, false when set to true
CutNext bool
// SkipAppendCurBatch causes Ordered to skip appending to CurBatch
SkipAppendCurBatch bool
// CurBatch is the currently outstanding messages in the batch
CurBatch []*cb.Envelope
......@@ -79,7 +82,9 @@ func (mbc *Receiver) Ordered(env *cb.Envelope) ([][]*cb.Envelope, bool) {
return res, true
}
mbc.CurBatch = append(mbc.CurBatch, env)
if !mbc.SkipAppendCurBatch {
mbc.CurBatch = append(mbc.CurBatch, env)
}
if mbc.CutNext {
logger.Debugf("Receiver: Returning regular batch")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment