gapic-generator-python icon indicating copy to clipboard operation
gapic-generator-python copied to clipboard

AsyncClient shouldn't instantiate a Client

Open jameslynnwu opened this issue 4 years ago • 0 comments

As seen in https://github.com/googleapis/python-pubsublite/blob/4a29b92c32b086750a2a720ce65b75f87a77aac4/google/cloud/pubsublite_v1/services/publisher_service/async_client.py#L168, async clients are set up by instantiating a standard client. PublisherServiceAsyncClient instantiates a PublisherServiceClient and all requests basically use self._client._transport to make the request.

This is done to utilize the code in the base client to process the initialization args. Instead, we could extract that functionality out and have the async and base client call out to them to avoid creating a PublisherServiceClient.

jameslynnwu avatar Jul 02 '21 22:07 jameslynnwu