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

Refactor a bit PullSubscription.fetch #397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

orsinium
Copy link
Contributor

  1. Reuse the same code for pulling from the queue in both _fetch_one and _fetch_n.
  2. Don't get from queue more than batch messages.
  3. Refactor this loop a bit: don't check if the queue is empty before pulling from it. Instead, try pulling and exiting on the QueueEmpty exception raised. "Ask for forgiveness, not permission". And since before it had except Exception: pass, it used to have 3 function calls instead of one now (because it was going on the next iteration loop on failure instead of exiting the loop immediately).
  4. Drop except Exception: pass, we don't want to suppress all ranges of exceptions when pulling from the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant