diff --git a/server/jetstream_cluster_test.go b/server/jetstream_cluster_test.go index 9b46a876..fe41ed9f 100644 --- a/server/jetstream_cluster_test.go +++ b/server/jetstream_cluster_test.go @@ -10662,7 +10662,7 @@ func TestJetStreamClusterStreamRepublish(t *testing.T) { Name: "RP", Storage: MemoryStorage, Subjects: []string{"foo", "bar", "baz"}, - Replicas: 1, + Replicas: 3, RePublish: &RePublish{ Source: ">", Destination: "RP.>", diff --git a/server/stream.go b/server/stream.go index 8519f481..9758ffa5 100644 --- a/server/stream.go +++ b/server/stream.go @@ -3569,7 +3569,7 @@ func (mset *stream) processJetStreamMsg(subject, reply string, hdr, msg []byte, thdrsOnly = mset.cfg.RePublish.HeadersOnly } } - republish := tsubj != _EMPTY_ + republish := tsubj != _EMPTY_ && isLeader // We hold the lock to this point to make sure nothing gets between us since we check for pre-conditions. // Currently can not hold while calling store b/c we have inline storage update calls that may need the lock.