Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove suboptimal logic in leasing behavior #816

Merged
merged 20 commits into from
Nov 11, 2022

Conversation

acocuzzo
Copy link
Contributor

@acocuzzo acocuzzo commented Oct 28, 2022

  1. When the streaming_pull_manager calls "_send_lease_modacks," we specific a single modify_ack_deadline_seconds to populate the ModackRequests, however in the dispatcher, we iterate over the requests to pass a list of deadline_seconds back to the streaming_pull_manager.send_unary_modack, where we then separate the requests by deadline.
    This causes unecessary list creation and iteration, which we eliminate by passing a "default_deadline" to dispatcher.modify_ack_deadline and streaming_pull_manager.send_unary_modack.

  2. We remove unnecessary casting of itertools.islice objects to lists in dispatcher.modify_ack_deadline

  3. We remove unecessary appending to a list and casting the list to a Set in the leaser, and instead pass a Set of expired_ack_ids from _send_lease_modacks.

  4. If exactly once is enabled, we check the return value of _send_lease_modacks and drop the expired ack ids from leasing

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: pubsub Issues related to the googleapis/python-pubsub API. labels Oct 28, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 28, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 28, 2022
@acocuzzo acocuzzo marked this pull request as ready for review October 28, 2022 22:40
@acocuzzo acocuzzo requested review from a team as code owners October 28, 2022 22:40
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 28, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 28, 2022
@product-auto-label product-auto-label bot added size: u Pull request is empty. and removed size: xs Pull request size is extra small. labels Nov 1, 2022
@acocuzzo acocuzzo marked this pull request as draft November 1, 2022 17:35
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: u Pull request is empty. labels Nov 3, 2022
@acocuzzo acocuzzo changed the title fix: subtract time spent leasing from max snooze value fix: remove suboptimal list operations in leasing Nov 3, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 3, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 3, 2022
@acocuzzo acocuzzo marked this pull request as ready for review November 3, 2022 18:23
@acocuzzo acocuzzo changed the title fix: remove suboptimal list operations in leasing fix: remove suboptimal logic in leasing behavior Nov 3, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 3, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 3, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 7, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 7, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 7, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 7, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 8, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 8, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@acocuzzo acocuzzo added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 10, 2022
@pradn pradn merged commit f067af3 into googleapis:main Nov 11, 2022
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 googleapis/python-pubsub API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants