Skip to content

Use the rpc's status to determine when to exit the request generator thread#5054

Merged
lukesneeringer merged 2 commits into
googleapis:masterfrom
theacodes:pubsub-request-queue
Mar 20, 2018
Merged

Use the rpc's status to determine when to exit the request generator thread#5054
lukesneeringer merged 2 commits into
googleapis:masterfrom
theacodes:pubsub-request-queue

Conversation

@theacodes
Copy link
Copy Markdown
Contributor

No description provided.

@theacodes theacodes added the api: pubsub Issues related to the Pub/Sub API. label Mar 16, 2018
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 16, 2018
@theacodes
Copy link
Copy Markdown
Contributor Author

/cc @nathanielmanistaatgoogle

@chemelnucfin
Copy link
Copy Markdown
Contributor

@jonparrott Could the _RequestQueueGenerator be in api_core?

@theacodes
Copy link
Copy Markdown
Contributor Author

@chemelnucfin possibly, but we should only promote it there once we need to.

for response in rpc:
print(response)
q.put(...)
"""

This comment was marked as spam.

This comment was marked as spam.

"""
with self._put_lock:
self._request_queue.put(request)
self._request_queue.put(request)

This comment was marked as spam.

request_generator = _RequestQueueGenerator(
self._request_queue, initial_request=initial_request)
rpc = policy.call_rpc(request_generator)
request_generator.rpc = rpc

This comment was marked as spam.

if self.rpc is not None and not self.rpc.is_active():
return True
else:
return False

This comment was marked as spam.

This comment was marked as spam.

Comment thread pubsub/tests/system.py
assert callback.calls >= 2

subscription.close()

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Copy Markdown
Contributor

tseaver commented Mar 19, 2018

LGTM if you add the docstrings for the arguments to _RequestQueueGenerator.

@lukesneeringer
Copy link
Copy Markdown
Contributor

I ran this for several hours without issue. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants