Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def load(self):

messages_percent = self._leaser.message_count / self._flow_control.max_messages
bytes_percent = self._leaser.bytes / self._flow_control.max_bytes
print(f"{messages_percent}, {bytes_percent}")
return max(messages_percent, bytes_percent)

def add_close_callback(self, callback):
Expand All @@ -208,12 +207,10 @@ def add_close_callback(self, callback):

def maybe_pause_consumer(self):
"""Check the current load and pause the consumer if needed."""
print(self.load)
if self.load >= 1.0:
if self._consumer is not None and not self._consumer.is_paused:
_LOGGER.debug("Message backlog over load at %.2f, pausing.", self.load)
self._consumer.pause()
print('paused')

def maybe_resume_consumer(self):
"""Check the current load and resume the consumer if needed."""
Expand All @@ -227,7 +224,6 @@ def maybe_resume_consumer(self):
return

if self.load < self.flow_control.resume_threshold:
print('resuming')
self._consumer.resume()
else:
_LOGGER.debug("Did not resume, current load is %s", self.load)
Expand Down