Use SearchServiceAsyncClient instead of SearchServiceClient
Problem
Currently, we're using SearchServiceClient
and self.client.search(request)
for searching gitlab docs, however, this operation happens in synchronous way, meaning it blocks the server thread until the response comes back, hence it causes a latency to the other endpoint requests.
In order to avoid the issue, we need to use AsyncIO/Co-routinue to execute the external gRPC call in async way. i.e.:
response = await self.client.search(request) # SearchServiceAsyncClient
instead of
response = self.client.search(request) # SearchServiceClient
Proposal
Use SearchServiceAsyncClient instead of SearchServiceClient
Auto generated
The following discussion from !838 (merged) should be addressed:
-
@stanhu started a discussion: (+1 comment) Question for later: should
SearchServiceAsyncClient
be used instead? https://cloud.google.com/python/docs/reference/retail/latest/google.cloud.retail_v2.services.search_service.SearchServiceAsyncClient