Skip to content

Commit

Permalink
fix: Remove bidi modacks on StreamingPull initial request (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
acocuzzo authored Jul 15, 2022
1 parent dc264e9 commit 1e7d469
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -927,20 +927,11 @@ def _get_initial_request(
A request suitable for being the first request on the stream (and not
suitable for any other purpose).
"""
# Any ack IDs that are under lease management need to have their
# deadline extended immediately.
if self._leaser is not None:
# Explicitly copy the list, as it could be modified by another
# thread.
lease_ids = list(self._leaser.ack_ids)
else:
lease_ids = []

# Put the request together.
request = gapic_types.StreamingPullRequest(
modify_deadline_ack_ids=list(lease_ids),
modify_deadline_seconds=[self.ack_deadline] * len(lease_ids),
stream_ack_deadline_seconds=stream_ack_deadline_seconds,
modify_deadline_ack_ids=[],
modify_deadline_seconds=[],
subscription=self._subscription,
client_id=self._client_id,
max_outstanding_messages=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,8 @@ def test__get_initial_request():
assert isinstance(initial_request, gapic_types.StreamingPullRequest)
assert initial_request.subscription == "subscription-name"
assert initial_request.stream_ack_deadline_seconds == 123
assert initial_request.modify_deadline_ack_ids == ["1", "2"]
assert initial_request.modify_deadline_seconds == [10, 10]
assert initial_request.modify_deadline_ack_ids == []
assert initial_request.modify_deadline_seconds == []


def test__get_initial_request_wo_leaser():
Expand Down

0 comments on commit 1e7d469

Please sign in to comment.