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

even if it is cached no_ack should affect to the get function #7852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion celery/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def get(self, timeout=None, propagate=True, interval=0.5,
if on_interval:
_on_interval.then(on_interval)

if self._cache:
if self._cache and not no_ack:
Copy link
Member

Choose a reason for hiding this comment

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

can you please add a unit test to verify this change?

Copy link
Author

Choose a reason for hiding this comment

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

I have no idea about unit test, can you explain how to do this?

Copy link
Author

Choose a reason for hiding this comment

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

To explain a little more in detail, if it becomes a cache through the ready function, no_ack is False and the consumer operates. After that, through the get function, the consumer should operate with no_ack set to True, but the cache value is returned and the function is terminated without operating the consumer with no_ack set to True.

I don't know how make exactly test code. I'm not sure how to write code that correct tests this phenomenon.

Copy link
Member

Choose a reason for hiding this comment

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

you can check this file to have an idea about related tests https://github.com/celery/celery/blob/master/t/unit/tasks/test_result.py you can try to figure out and learn something new. but if you can not at all then we will see

if propagate:
self.maybe_throw(callback=callback)
return self.result
Expand Down