-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
[IMP] queue_job: Don't raise a warning for valid context #679
Conversation
Hi @guewen, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be logged as warning if test_enable is not set? (e.g. run on production). That was maybe the original intent?
And if we really want (I don't do it) to run without delay ? I think this could be done without warnings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but adding the test_enable
check would be superior.
This PR has the |
@simahawk Your review on this would be welcome. Thanks |
7f5b7b4
to
d84e1a4
Compare
f8d41dd
to
0cb2b91
Compare
AFAIR yes :)
AFAIR I was thinking of this as well. Thinking again about this right now: in fact, if you do it explicitly there's no reason to log a warning no matter if in tests or in prod mode. IMO we can skip the distinction and always log the same info message. |
Indeed, putting it in the context is sufficient |
I'm good with never warning. |
So, just one info message if context used, correct (I need to change this PR) ? |
As the 'queue_job__no_delay' context key is the valid one to use, don't raise warnings during tests, but log it as information level.
0cb2b91
to
4919c65
Compare
self.env["test.queue.job"] | ||
.with_context(_job_force_sync=True) | ||
.delay_me(1, kwarg=2) | ||
with self.assertLogs(level="WARNING") as log_catcher: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test needs an update no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, corresponding to true warnings: https://github.com/OCA/queue/pull/679/files#diff-6e33951ef77e0428f3edcd938952cf20d30ca84e703406c08685f3d70d68da86R28
/ocabot merge patch |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at f91aced. Thanks a lot for contributing to OCA. ❤️ |
As the 'queue_job__no_delay' context key is the valid one to use, don't raise warnings during tests, but log it as information level.
@simahawk Warning level should be only used to show something that could goes wrong (e.g.: deprecated methods, wrong definitions, ...). In this case, the use of the correct key context should not raise a warning and log as information only.
As I try to keep an eye on real warnings, they are lost in the crowd like:
https://github.com/OCA/sale-workflow/actions/runs/10522761814/job/29156065217#step:8:3025