Skip to content

Add streaming pull manager and integrate new subscriber logic#5237

Merged
theacodes merged 6 commits into
googleapis:masterfrom
theacodes:pubsub-subscriber-impl
Apr 26, 2018
Merged

Add streaming pull manager and integrate new subscriber logic#5237
theacodes merged 6 commits into
googleapis:masterfrom
theacodes:pubsub-subscriber-impl

Conversation

@theacodes
Copy link
Copy Markdown
Contributor

Adds a new method, subscribe_experimental, to the pubsub subscriber client to use this new functionality. Leaves the older subscription implementation in place for now (will be removed by another PR after this gets more testing.)

Adds a new method, `subscribe_experimental`, to the pubsub subscriber client to use this new functionality. Leaves the older subscription implementation in place for now (will be removed by another PR after this gets more testing.)
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 26, 2018
@tseaver tseaver added the api: pubsub Issues related to the Pub/Sub API. label Apr 26, 2018

class Dispatcher(object):
def __init__(self, queue, subscriber):
def __init__(self, manager, queue):

This comment was marked as spam.

This comment was marked as spam.

for item in items:
time_to_ack = item.time_to_ack
if time_to_ack is not None:
self._manager.ack_histogram.add(int(time_to_ack))

This comment was marked as spam.

This comment was marked as spam.

self._leaser = leaser.Leaser(self)
self._leaser.start()

def close(self, reason=None):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


# Put the request together.
request = types.StreamingPullRequest(
modify_deadline_ack_ids=list(lease_ids),

This comment was marked as spam.

This comment was marked as spam.

self._scheduler.schedule(self._callback, message)

def _should_recover(self, exception):
"""Determine if an error on the RPC straem should be recovered.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@lukesneeringer lukesneeringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but I think it would be wise to add that one lock that is noted.

"""Start a thread to dispatch requests queued up by callbacks.
Spawns a thread to run :meth:`dispatch_callback`.
"""
if self._thread is not None:

This comment was marked as spam.

This comment was marked as spam.

return self._ack_deadline

@property
def load(self):

This comment was marked as spam.

This comment was marked as spam.

@theacodes theacodes merged commit 1acc8c2 into googleapis:master Apr 26, 2018
@theacodes theacodes deleted the pubsub-subscriber-impl branch April 26, 2018 22:32
parthea pushed a commit that referenced this pull request Mar 2, 2026
Adds a new method, `subscribe_experimental`, to the pubsub subscriber client to use this new functionality. Leaves the older subscription implementation in place for now (will be removed by another PR after this gets more testing.)
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