[FIXED] JetStream: sampling not updated during consumer update

Resolves #2941

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2022-03-28 10:58:58 -06:00
parent 4e5519f999
commit 25886e8819
2 changed files with 7 additions and 2 deletions

View File

@@ -1350,6 +1350,13 @@ func (o *consumer) updateConfig(cfg *ConsumerConfig) error {
// We need both locks here so do in Go routine.
go o.setRateLimitNeedsLocks()
}
if cfg.SampleFrequency != o.cfg.SampleFrequency {
s := strings.TrimSuffix(cfg.SampleFrequency, "%")
// String has been already verified for validity up in the stack, so no
// need to check for error here.
sampleFreq, _ := strconv.Atoi(s)
o.sfreq = int32(sampleFreq)
}
// Record new config for others that do not need special handling.
// Allowed but considered no-op, [Description, MaxDeliver, SampleFrequency, MaxWaiting, HeadersOnly]

View File

@@ -16080,8 +16080,6 @@ func TestJetStreamConsumerAckSampling(t *testing.T) {
}
func TestJetStreamConsumerAckSamplingSpecifiedUsingUpdateConsumer(t *testing.T) {
t.Skip("sampling msg is not sent when sampling option is part of update flow")
s := RunBasicJetStreamServer()
if config := s.JetStreamConfig(); config != nil {
defer removeDir(t, config.StoreDir)