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

some comments to the SmartQueue #357

Merged
merged 4 commits into from
May 11, 2021
Merged

some comments to the SmartQueue #357

merged 4 commits into from
May 11, 2021

Conversation

shadeofblue
Copy link
Contributor

No description provided.

@shadeofblue shadeofblue requested review from a team and azawlocki April 29, 2021 10:46
@shadeofblue shadeofblue self-assigned this Apr 29, 2021
Copy link
Contributor

@azawlocki azawlocki left a comment

Choose a reason for hiding this comment

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

Good job! I've found some minor issues nonetheless.

@@ -27,7 +27,16 @@
Item = TypeVar("Item")


class Handle(Generic[Item], object):
class Handle(
Generic[Item], object
Copy link
Contributor

Choose a reason for hiding this comment

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

While we're here, let's remove this object, so Python2-ic

class Handle(Generic[Item], object):
class Handle(
Generic[Item], object
): # Handling? QueueItem? ConsumedItem? ConsumerItem? ConsumerBinding?
Copy link
Contributor

Choose a reason for hiding this comment

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

I've got used to Handle, it's not that bad. Either way, let's not forget to remove this comment.

def __init__(self, items: Iterable[Item]):
"""
:param items: the items to be iterated over
:param retry_cnt:
Copy link
Contributor

Choose a reason for hiding this comment

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

If we drop this argument from __init__() (I understand that's because it's unused) then let's not add a docstring for it.

@@ -126,13 +143,15 @@ async def mark_done(self, handle: Handle[Item]) -> None:
)

async def reschedule(self, handle: Handle[Item]) -> None:
"""free the item for reassignment to another consumer"""
Copy link
Contributor

Choose a reason for hiding this comment

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

I we ever run yapapi code through flake8 it will complain about method docstrings not starting with a capital letter and not ending with a full stop.

@@ -178,6 +203,7 @@ def __exit__(

@property
def last_item(self) -> Optional[Item]:
"""shouldn't it be called `current_item` ?"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I'd call it current_item as well.

@shadeofblue
Copy link
Contributor Author

@azawlocki addressed your comments, pls re-review :)

@shadeofblue shadeofblue requested a review from azawlocki May 10, 2021 13:38
Copy link
Contributor

@azawlocki azawlocki left a comment

Choose a reason for hiding this comment

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

Nice!

@shadeofblue shadeofblue merged commit 24bff44 into master May 11, 2021
@shadeofblue shadeofblue deleted the blue/smartq-comments branch May 11, 2021 08:18
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.

2 participants