[Cython AIO] Fix Aio tests time out issue

pull/37917/head
Xuan Wang 2 months ago
parent b41b323fbe
commit 063d27aee9
  1. 4
      src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pxd.pxi
  2. 6
      src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi

@ -23,7 +23,7 @@ IF UNAME_SYSNAME == "Windows":
int win_socket_send "send" (WIN_SOCKET s, const char *buf, int len, int flags) int win_socket_send "send" (WIN_SOCKET s, const char *buf, int len, int flags)
cdef void _unified_socket_write(int fd) nogil cdef void _unified_socket_write(int fd) noexcept nogil
cdef class BaseCompletionQueue: cdef class BaseCompletionQueue:
@ -48,5 +48,5 @@ cdef class PollerCompletionQueue(BaseCompletionQueue):
cdef object _write_socket # socket.socket cdef object _write_socket # socket.socket
cdef dict _loops # Mapping[asyncio.AbstractLoop, _BoundEventLoop] cdef dict _loops # Mapping[asyncio.AbstractLoop, _BoundEventLoop]
cdef void _poll(self) nogil cdef void _poll(self) noexcept nogil
cdef shutdown(self) cdef shutdown(self)

@ -22,12 +22,12 @@ cdef float _POLL_AWAKE_INTERVAL_S = 0.2
cdef bint _has_fd_monitoring = True cdef bint _has_fd_monitoring = True
IF UNAME_SYSNAME == "Windows": IF UNAME_SYSNAME == "Windows":
cdef void _unified_socket_write(int fd) nogil: cdef void _unified_socket_write(int fd) noexcept nogil:
win_socket_send(<WIN_SOCKET>fd, b"1", 1, 0) win_socket_send(<WIN_SOCKET>fd, b"1", 1, 0)
ELSE: ELSE:
from posix cimport unistd from posix cimport unistd
cdef void _unified_socket_write(int fd) nogil: cdef void _unified_socket_write(int fd) noexcept nogil:
unistd.write(fd, b"1", 1) unistd.write(fd, b"1", 1)
@ -94,7 +94,7 @@ cdef class PollerCompletionQueue(BaseCompletionQueue):
else: else:
self._loops[loop] = _BoundEventLoop(loop, self._read_socket, self._handle_events) self._loops[loop] = _BoundEventLoop(loop, self._read_socket, self._handle_events)
cdef void _poll(self) nogil: cdef void _poll(self) noexcept nogil:
cdef grpc_event event cdef grpc_event event
cdef CallbackContext *context cdef CallbackContext *context

Loading…
Cancel
Save