Tweak timing for test to prevent flapping

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2022-04-09 07:50:21 -07:00
parent 331c2faaa6
commit cd7f16f28a
2 changed files with 7 additions and 5 deletions

View File

@@ -4103,16 +4103,14 @@ func (c *client) processMsgResults(acc *Account, r *SublistResult, msg, deliver,
// Check for JetStream encoded reply subjects.
// For now these will only be on $JS.ACK prefixed reply subjects.
var remapped bool
if len(creply) > 0 &&
c.kind != CLIENT && c.kind != SYSTEM && c.kind != JETSTREAM && c.kind != ACCOUNT &&
bytes.HasPrefix(creply, []byte(jsAckPre)) {
// We need to rewrite the subject and the reply.
if li := bytes.LastIndex(creply, []byte("@")); li != -1 && li < len(creply)-1 {
remapped = true
subj, creply = creply[li+1:], creply[:li]
// Make sure deliver is set if inbound from a route.
if c.kind == ROUTER {
deliver = subj
}
}
}
@@ -4166,6 +4164,10 @@ func (c *client) processMsgResults(acc *Account, r *SublistResult, msg, deliver,
dsubj = append(_dsubj[:0], sub.im.to...)
}
// Make sure deliver is set if inbound from a route.
if remapped && c.kind == ROUTER {
deliver = subj
}
// If we are mapping for a deliver subject we will reverse roles.
// The original subj we set from above is correct for the msg header,
// but we need to transform the deliver subject to properly route.

View File

@@ -6695,7 +6695,7 @@ func TestJetStreamClusterSingleLeafNodeWithoutSharedSystemAccount(t *testing.T)
t.Fatalf("Unexpected publish error: %v", err)
}
// Make sure the message arrives in our mirror.
checkFor(t, 2*time.Second, 100*time.Millisecond, func() error {
checkFor(t, 5*time.Second, 100*time.Millisecond, func() error {
si, err := jsLocal.StreamInfo("M")
if err != nil {
return fmt.Errorf("Could not get stream info: %v", err)