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

add accept parameter to SimpleQueue class #1140

Merged
merged 5 commits into from
May 22, 2021

Conversation

lsaavedr
Copy link
Contributor

please add 'accept' parameter to SimpleQueue class

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

please add tests

Copy link

@drsantos20 drsantos20 left a comment

Choose a reason for hiding this comment

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

Do we already have tests to cover this? can we update? Just let me know and i can help you

@auvipy auvipy closed this May 17, 2020
@auvipy auvipy reopened this May 17, 2020
@auvipy auvipy added this to the 4.6.0 milestone May 17, 2020
@matusvalo matusvalo self-assigned this Oct 14, 2020
@matusvalo
Copy link
Member

Hi @drsantos20. You can start adding tests here: https://github.com/celery/kombu/blob/60dc3456368a06ed4125ea9eac9c06e7fcf5cffe/t/unit/test_simple.py

I would put it to Both test_SimpleQueue and test_SimpleBuffer classes.

@thedrow thedrow modified the milestones: 4.6.0, 5.1.0 Feb 24, 2021
@matusvalo
Copy link
Member

I have added unittests and fixed slightly the PR. Please review. @celery/core-developers

Copy link

@maybe-sybr maybe-sybr left a comment

Choose a reason for hiding this comment

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

A few minor changes which I think would make this better. I'd also like to see a test for what happens if we pass in an empty list/set for the accept kwarg.

kombu/simple.py Outdated
producer = messaging.Producer(channel, exchange,
serializer=serializer,
routing_key=routing_key,
compression=compression)
super().__init__(channel, producer,
consumer, no_ack, **kwargs)
consumer, no_ack, accept)

Choose a reason for hiding this comment

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

Why has this lost the **kwargs passthrough? We still accept them in the method signature so I assume we still need to pass them along to be cooperative.

Copy link
Member

@matusvalo matusvalo May 20, 2021

Choose a reason for hiding this comment

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

The kwargs are redundant. If you have a look to __init__ definition of parent class you will see parameters only that are explicitly used:

 16 class SimpleBase:
 17     Empty = Empty
 18     _consuming = False
 19
 20     def __enter__(self):
 21         return self
 22
 23     def __exit__(self, *exc_info):
 24         self.close()
 25
 26     def __init__(self, channel, producer, consumer, no_ack=False, accept=None):

hence the **kwargs is totally useless here.

kombu/simple.py Outdated Show resolved Hide resolved
@matusvalo
Copy link
Member

I'd also like to see a test for what happens if we pass in an empty list/set for the accept kwarg.
done.

@maybe-sybr I have implemented your comments.

@matusvalo matusvalo requested a review from maybe-sybr May 20, 2021 11:18
Copy link

@maybe-sybr maybe-sybr left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @matusvalo

@maybe-sybr
Copy link

We haven't done an RC for kombu like we have with celery, so this could arguably land but I'll leave that to @thedrow since he's managing the releases.

@matusvalo matusvalo merged commit e6d76d1 into celery:master May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants