mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Suppress multiple out of space warnings
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -83,6 +83,7 @@ type jetStream struct {
|
||||
apiCalls int64
|
||||
apiSubs *Sublist
|
||||
disabled bool
|
||||
oos bool
|
||||
}
|
||||
|
||||
// This represents a jetstream enabled account.
|
||||
@@ -253,17 +254,32 @@ func (s *Server) setupJetStreamExports() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) jetStreamOOSPending() (wasPending bool) {
|
||||
s.mu.Lock()
|
||||
js := s.js
|
||||
s.mu.Unlock()
|
||||
if js != nil {
|
||||
js.mu.Lock()
|
||||
wasPending = js.oos
|
||||
js.oos = true
|
||||
js.mu.Unlock()
|
||||
}
|
||||
return wasPending
|
||||
}
|
||||
|
||||
func (s *Server) setJetStreamDisabled() {
|
||||
s.mu.Lock()
|
||||
js := s.js
|
||||
s.mu.Unlock()
|
||||
js.mu.Lock()
|
||||
js.disabled = true
|
||||
js.mu.Unlock()
|
||||
if js != nil {
|
||||
js.mu.Lock()
|
||||
js.disabled = true
|
||||
js.mu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) handleOutOfSpace(stream string) {
|
||||
if s.JetStreamEnabled() {
|
||||
if s.JetStreamEnabled() && !s.jetStreamOOSPending() {
|
||||
s.Errorf("JetStream out of space, will be DISABLED")
|
||||
go s.DisableJetStream()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user