fix(poller): add 64MB cap on DEVICE_EVENTS NATS stream
Without a byte limit, the stream grows unbounded within its 24h max_age window. At 101 devices polling every 60s, it hits 128MB in ~10 hours and OOMs the NATS container. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,8 @@ func NewPublisher(natsURL string) (*Publisher, error) {
|
|||||||
"audit.session.end.>",
|
"audit.session.end.>",
|
||||||
},
|
},
|
||||||
MaxAge: 24 * time.Hour,
|
MaxAge: 24 * time.Hour,
|
||||||
|
MaxBytes: 64 * 1024 * 1024, // 64MB cap — discard oldest when full
|
||||||
|
Discard: jetstream.DiscardOld,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
nc.Close()
|
nc.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user