mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-17 11:24:44 -07:00
Interest based retention should not store if no consumers present.
Fix for https://github.com/nats-io/jetstream/issues/314 Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -760,6 +760,7 @@ func (mset *Stream) processInboundJetStreamMsg(_ *subscription, pc *client, subj
|
||||
name := mset.config.Name
|
||||
maxMsgSize := int(mset.config.MaxMsgSize)
|
||||
numConsumers := len(mset.consumers)
|
||||
interestRetention := mset.config.Retention == InterestPolicy
|
||||
|
||||
// Process msgId if we have headers.
|
||||
var msgId string
|
||||
@@ -795,7 +796,7 @@ func (mset *Stream) processInboundJetStreamMsg(_ *subscription, pc *client, subj
|
||||
// Check to see if we are over the account limit.
|
||||
if maxMsgSize >= 0 && len(msg) > maxMsgSize {
|
||||
response = []byte("-ERR 'message size exceeds maximum allowed'")
|
||||
} else {
|
||||
} else if !interestRetention || numConsumers > 0 {
|
||||
// Headers.
|
||||
if pc != nil && pc.pa.hdr > 0 {
|
||||
hdr = msg[:pc.pa.hdr]
|
||||
|
||||
Reference in New Issue
Block a user