Uh oh!
There was an error while loading. Please reload this page.
[10.0][IMP] queue_job: Don't prefetch fields when vacuum + bumpversion - #115
[10.0][IMP] queue_job: Don't prefetch fields when vacuum + bumpversion#115rousseldenis wants to merge 2 commits into
Conversation
rousseldenis
commented
Dec 14, 2018
@guewen I bumped version as it was not done for long. But in separate commit if you disagree. |
| """ | ||
| deadline = datetime.now() - timedelta(days=self._removal_interval) | ||
| jobs = self.search( | ||
| jobs = self.with_context(prefetch_fields=False).search( |
There was a problem hiding this comment.
I was sure that the prefetch only happen the first time you access a field (other than id)?
There was a problem hiding this comment.
I will try to objective that with a test script (not in the module)
2dc130c to
e44038dComparerousseldenis
commented
Dec 18, 2018
@guewen I think you're right. |
| job_obj = self.env['queue.job'] | ||
| deadline = datetime.now() - timedelta(days=self._removal_interval) | ||
| jobs = self.search( | ||
| jobs_ids = self.with_context(prefetch_fields=True).search( |
| cr.commit() | ||
| except OperationalError: | ||
| if use_new_cursor: | ||
| cr.rollback() |
There was a problem hiding this comment.
@rousseldenis IMO all the logic should be enclosed into a try except finally block
ifuse_new_cursor:
cr=registry(self._cr.dbname).cursor()
try:
self=self.with_env(self.env(cr=cr))
jobs=job_obj.browse(jobs_ids[:jobs_set])
jobs_ids=jobs_ids[jobs_set:]
jobs.unlink()
ifuse_new_cursor:
cr.commit()
exceptOperationalError:
ifuse_new_cursor:
cr.rollback()
raisefinally:
ifuse_new_cursor:
cr.close()e44038d to
b5d8160Compareb5d8160 to
c4e8cafComparerousseldenis
commented
Jan 7, 2019
lmignon
left a comment
There was a problem hiding this comment.
@rousseldenis Can you modify the changlog PLZ https://github.com/OCA/queue/blob/10.0/queue_job/README.rst#changelog
rousseldenis
commented
Jan 14, 2019
sbidoul
commented
Jan 14, 2019
@rousseldenis are you sure the benefit is worth the additional code complexity? |
rousseldenis
commented
Jan 15, 2019
@sbidoul You have to handle also mail messages. So, in fact there should be multiple sql deletes. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
@guewen@lmignon
Did this as sometimes, the amount of jobs is huge and there is no need fetching fields.