Skip to content

Commit

Permalink
Supply a timeout to queue.get to avoid spinlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Oct 2, 2024
1 parent 0fddc65 commit d16b69f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ def _generate_frames(self, subscription: mrc.Subscription) -> typing.Iterator[Me
# shutdown since we already returned an OK response to the client.
df = None
try:
df = self._queue.get(block=False)
# Intentionally not using self._queue_timeout here since that value is rather high
df = self._queue.get(block=False, timeout=0.1)
self._queue_size -= 1
except queue.Empty:
if (not self._http_server.is_running() or self.is_stop_requested()
Expand Down

0 comments on commit d16b69f

Please sign in to comment.