MCPcopy
hub / github.com/nats-io/nats.go / PendingLimits

Method PendingLimits

nats.go:5648–5661  ·  view source on GitHub ↗

PendingLimits returns the current limits for this subscription. If no error is returned, a negative value indicates that the given metric is not limited.

()

Source from the content-addressed store, hash-verified

5646// If no error is returned, a negative value indicates that the
5647// given metric is not limited.
5648func (s *Subscription) PendingLimits() (int, int, error) {
5649 if s == nil {
5650 return -1, -1, ErrBadSubscription
5651 }
5652 s.mu.Lock()
5653 defer s.mu.Unlock()
5654 if s.conn == nil || s.closed {
5655 return -1, -1, ErrBadSubscription
5656 }
5657 if s.typ == ChanSubscription {
5658 return -1, -1, ErrTypeSubscription
5659 }
5660 return s.pMsgsLimit, s.pBytesLimit, nil
5661}
5662
5663// SetPendingLimits sets the limits for pending msgs and bytes for this subscription.
5664// Zero is not allowed. Any negative value means that the given metric is not limited.

Callers 5

TestSetPendingLimitsFunction · 0.95
TestNilConnectionFunction · 0.95
TestSlowAsyncSubscriberFunction · 0.80
TestSubscriptionTypesFunction · 0.80

Calls

no outgoing calls

Tested by 5

TestSetPendingLimitsFunction · 0.76
TestNilConnectionFunction · 0.76
TestSlowAsyncSubscriberFunction · 0.64
TestSubscriptionTypesFunction · 0.64