Pause the writer if queue is above the high water mark.
(self)
| 299 | # runs and skipping a pause() - resume() cycle that would otherwise occur. |
| 300 | |
| 301 | def maybe_pause(self) -> None: |
| 302 | """Pause the writer if queue is above the high water mark.""" |
| 303 | # Skip if flow control is disabled. |
| 304 | if self.high is None: |
| 305 | return |
| 306 | |
| 307 | assert self.mutex.locked() |
| 308 | |
| 309 | # Check for "> high" to support high = 0. |
| 310 | if self.frames.qsize() > self.high and not self.paused: |
| 311 | self.paused = True |
| 312 | self.pause() |
| 313 | |
| 314 | def maybe_resume(self) -> None: |
| 315 | """Resume the writer if queue is below the low water mark.""" |