Conversation
| @@ -0,0 +1,43 @@ | |||
| # Copyright 2019 Creu Blanca | |||
| def _compute_job_is_profiled(self): | ||
| for job in self: | ||
| # don't care about perf as this is loaded only on the job form view | ||
| profile_name = job.job_function_id._profile_make_name(job) |
There was a problem hiding this comment.
The job_function_id is not a required field for a job !
This could crash.
There was a problem hiding this comment.
There was a problem hiding this comment.
Yes, thank you. We may also have an issue with is_profiling_enabled function if the job function is no set, could you check.
|
2 similar branches exist: The OCA one had 2 commits more than the camptocamp one. I took the missing commits. @simahawk I think we can close the OCA branch ? |
| ) | ||
| ) | ||
|
|
||
| @api.constrains("profiling_enabled") |
There was a problem hiding this comment.
This constraint should track profiling_until too.
Also: maybe it'd be useful to check that profiling_until is actually set in the future, instead of the past.
| def test_no_queue_job_function(self): | ||
| job1 = self.env.user.with_delay().read(["id"]) | ||
| job1.store() | ||
| job_rec1 = job1.db_record() | ||
| self.env["queue.job.function"]._profile_make_name(job_rec1) |
There was a problem hiding this comment.
Please add some comments to describe what's being tested.
Same applies to most other tests as well.
| compute_sudo=True, | ||
| ) | ||
|
|
||
| def _compute_job_is_profiled(self): |
There was a problem hiding this comment.
Please decorate this method with @api.depends(...), so that the field's value can be handled properly (eg: invalidated and recomputed correctly when needed).
| if not self: | ||
| return f"queue.job {job.uuid} - <anonymous>" | ||
| self.ensure_one() | ||
| return f"queue.job {job.uuid} - {self.name}" |
There was a problem hiding this comment.
| if not self: | |
| return f"queue.job {job.uuid} - <anonymous>" | |
| self.ensure_one() | |
| return f"queue.job {job.uuid} - {self.name}" | |
| return f"queue.job {job.uuid} - {self.name or '<anonymous>'}" |
No description provided.