|
|
@ -32,11 +32,11 @@ cdef class CallbackFailureHandler: |
|
|
|
|
|
|
|
|
|
|
|
cdef class CallbackWrapper: |
|
|
|
cdef class CallbackWrapper: |
|
|
|
|
|
|
|
|
|
|
|
def __cinit__(self, object future, CallbackFailureHandler failure_handler): |
|
|
|
def __cinit__(self, object future, object loop, CallbackFailureHandler failure_handler): |
|
|
|
self.context.functor.functor_run = self.functor_run |
|
|
|
self.context.functor.functor_run = self.functor_run |
|
|
|
self.context.waiter = <cpython.PyObject*>future |
|
|
|
self.context.waiter = <cpython.PyObject*>future |
|
|
|
# TODO(lidiz) switch to future.get_loop() which is available 3.7+. |
|
|
|
# TODO(lidiz) switch to future.get_loop() which is available 3.7+. |
|
|
|
self.context.loop = <cpython.PyObject*>future._loop |
|
|
|
self.context.loop = <cpython.PyObject*>loop |
|
|
|
self.context.failure_handler = <cpython.PyObject*>failure_handler |
|
|
|
self.context.failure_handler = <cpython.PyObject*>failure_handler |
|
|
|
self.context.callback_wrapper = <cpython.PyObject*>self |
|
|
|
self.context.callback_wrapper = <cpython.PyObject*>self |
|
|
|
# NOTE(lidiz) Not using a list here, because this class is critical in |
|
|
|
# NOTE(lidiz) Not using a list here, because this class is critical in |
|
|
@ -84,6 +84,7 @@ async def execute_batch(GrpcCallWrapper grpc_call_wrapper, |
|
|
|
cdef object future = loop.create_future() |
|
|
|
cdef object future = loop.create_future() |
|
|
|
cdef CallbackWrapper wrapper = CallbackWrapper( |
|
|
|
cdef CallbackWrapper wrapper = CallbackWrapper( |
|
|
|
future, |
|
|
|
future, |
|
|
|
|
|
|
|
loop, |
|
|
|
CallbackFailureHandler('execute_batch', operations, ExecuteBatchError)) |
|
|
|
CallbackFailureHandler('execute_batch', operations, ExecuteBatchError)) |
|
|
|
cdef grpc_call_error error = grpc_call_start_batch( |
|
|
|
cdef grpc_call_error error = grpc_call_start_batch( |
|
|
|
grpc_call_wrapper.call, |
|
|
|
grpc_call_wrapper.call, |
|
|
|