• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server / 21425568901

27 Jan 2026 11:18AM UTC coverage: 84.752% (+0.2%) from 84.584%
21425568901

push

github

web-flow
[IMPROVED] Remove no interest messages from head of stream (#7766)

When using interest-based streams, messages that no longer have interest
should be removed. For example when deleting a consumer that was the
last one marking interest of subject A, then all messages matching
subject A should be purged from the stream. If this goes above a 100k
threshold, this linear scan will be expensive to perform so we don't
block any other progress from happening. However, this would leave those
messages around until a stream limit is reached.

This PR doesn't fully fix the issue, since the full scan is still
expensive, but it does remove any messages at the "head" of the stream
that have lost interest. For an active interest stream that's
continuously consumed, these messages will be removed naturally without
needing to block by going through them and removing immediately, as
they'll naturally end up at the "head" of the stream and are eligible
for removal.

Resolves https://github.com/nats-io/nats-server/issues/6747,
https://github.com/nats-io/nats-server/issues/7754

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

74449 of 87843 relevant lines covered (84.75%)

354152.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.28
/src/github.com/nats-io/nats-server/server/leafnode.go


Source Not Available

The file "src/github.com/nats-io/nats-server/server/leafnode.go" isn't available on github. Either it's been removed, or the repo root directory needs to be updated.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc