Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gRPC with gevent

I am using gRPC in a gevent monkey patched environment and I am seeing deadline exceeded for a deadline of 500ms. But the service responds in < 40ms. I am assuming this is due to the use of gevent, messing up the timing. But now where I have applied:

import grpc.experimental.gevent as grpc_gevent
grpc_gevent.init_gevent()

I am seeing DEADLINE_EXCEEDED even in my integration test.

like image 838
Mahoni Avatar asked Jul 31 '26 06:07

Mahoni


1 Answers

I'm having the same problem. After looking at init_gevent, I found a sentence:

This must be called AFTER the python standard lib has been patched, but BEFORE creating and gRPC objects.

Try adding the import at the top:

from gevent import monkey
monkey.patch_all()
like image 61
hupo Avatar answered Aug 02 '26 21:08

hupo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!