Skip to content

Commit

Permalink
Check availability of poll method before using
Browse files Browse the repository at this point in the history
When eventlet is monkey patched, select.poll is removed since
it is not thread safe. So check availability of `poll` method
before using it.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde committed Jun 30, 2022
1 parent 3165e80 commit 13c4c76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kubernetes/base/stream/ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def update(self, timeout=0):
# efficient as epoll. Will work for fd numbers above 1024.
# select.epoll() - newest and most efficient way of polling.
# However, only works on linux.
if sys.platform.startswith('linux') or sys.platform in ['darwin']:
if hasattr(select, "poll"):
poll = select.poll()
poll.register(self.sock.sock, select.POLLIN)
r = poll.poll(timeout)
Expand Down

0 comments on commit 13c4c76

Please sign in to comment.