-
-
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
[FIX] JobsTrap
perform_enqueued_jobs
not working with jobs creating new jobs (issue OCA#651)
#652
Conversation
JobsTrap
perform_enqueued_jobs
not working with jobs creating new jobs (issue OCA#651)
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.
Makes sense, thanks
queue_job/tests/common.py
Outdated
@@ -227,13 +227,13 @@ def perform_enqueued_jobs(self): | |||
def by_graph(job): | |||
return job.graph_uuid or "" | |||
|
|||
sorted_jobs = sorted(self.enqueued_jobs, key=by_graph) | |||
sorted_jobs = sorted(self.enqueued_jobs[:], key=by_graph) |
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.
I don't believe the extra [:] slicing here is necessary.
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.
I agree, since sorted
returns already a new list.
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.
Thanks for your contrib!
Could you please rewrite the commit msg to something like
[fix] queue_job: JobsTrap.perform_enqueued_jobs
Closes #651
pre-approving
queue_job/tests/common.py
Outdated
@@ -227,13 +227,13 @@ def perform_enqueued_jobs(self): | |||
def by_graph(job): | |||
return job.graph_uuid or "" | |||
|
|||
sorted_jobs = sorted(self.enqueued_jobs, key=by_graph) | |||
sorted_jobs = sorted(self.enqueued_jobs[:], key=by_graph) |
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.
I agree, since sorted
returns already a new list.
@simahawk everything's done ;) |
/ocabot merge patch |
Hey, thanks for contributing! Proceeding to merge this for you. |
@fd-oncodna tnx, any chance you can backoprt this to 15 and 16? |
Congratulations, your PR was merged at 20d3436. Thanks a lot for contributing to OCA. ❤️ |
|
JobsTrap
perform_enqueued_jobs
not working with jobs creating new jobs. After a call toJobsTrap.perform_enqueued_jobs
theenqueued_jobs
attribute is empty, even if one of the jobs executed had the effect of creating new jobs. That is because after executing the jobs of the queue in a loop,JobsTrap.perform_enqueued_jobs
sets theenqueued_jobs
to[]
ignoring the newly created jobs.