Skip to content

PubSub: Default thread-based subscriber Policy's on_response() implementation degenerates into series of synchronous calls because of debug statement #4167

@jeffkpayne

Description

@jeffkpayne

https://github.com/GoogleCloudPlatform/google-cloud-python/blob/4e17158c0f14e0e91cbeb74c3e8483c5a231e9ac/pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py#L147

While testing out the new PubSub API (v 0.28.3), I noticed that the default thread-based Policy, which uses a ThreadPoolExecutor(max_workers=10) seemed to be executing the subscriber callbacks sequentially, instead of asynchronously. Upon introspection of the source, it looks like the above referenced code:

...
future = self._executor.submit(self._callback, message)
logger.debug('Result: %s' % future.result())

will block until self._callback completes, because of the call to future.result(). Or am I losing my mind? Thanks!

Metadata

Metadata

Labels

api: pubsubIssues related to the Pub/Sub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions