Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a timeout to the queue.get call in HttpServerSourceStage to avoid spinlocking #1928

Merged
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
Loading