Repository navigation
[19.0] [IMP] queue_job: clean old jobs from the base autovacuum - #1014
Conversation
f6c2fe9 to
b843e73
Compare
| { | ||
| "name": "Job Queue", | ||
| "version": "19.0.2.1.6", | ||
| "version": "19.0.2.2.0", |
There was a problem hiding this comment.
manual bump for the migration script
divad1196
left a comment
There was a problem hiding this comment.
@ivantodorovich
The PR works, but the vacuum could still be done with the ORM.
I proposed a different version that also handle a forgotten edge-case
amh-mw
left a comment
There was a problem hiding this comment.
Code review only, LGTM. Odoo 14 introduced api.autovacuum!
Neutralized databases disable every cron except the base autovacuum, so old jobs were never removed there. Replace the dedicated cron with an @api.autovacuum method, deleting in batches of 1000.
b843e73 to
8ec9ef2
Compare
| domain = Domain.OR( | ||
| channel_domain | ||
| & ( | ||
| Domain("date_done", "<=", f"-{days}d") |
There was a problem hiding this comment.
Works but cannot be backported as-is.
The code from the proposal
now = fields.Datetime.now()
def done_before(deadline):
return Domain("date_done", "<=", deadline) | Domain(
"date_cancelled", "<=", deadline
)
domain = Domain.OR(
Domain("channel", "=", channel)
& done_before(
now - timedelta(days=get_interval(channel))
)
for channel in old_jobs_channels
)is more verbose but was made to be retrocompatible so that we can backport the change seemlessly.
| (Domain("channel", "=", channel.complete_name), channel.removal_interval) | ||
| for channel in channels | ||
| ] | ||
| intervals.append( |
There was a problem hiding this comment.
Different approach is ok 👍
Can we have a comment on top of this case?
| intervals.append( | |
| # Jobs channel might not exist anymore but still need clean up | |
| # We handle it using root channel's removal_interval as default value | |
| intervals.append( |
|
This PR has the |
|
/ocabot merge nobump |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 9e3a0f3. Thanks a lot for contributing to OCA. ❤️ |
Neutralized databases disable every cron except the base autovacuum, so old jobs were never removed there.
Replace the dedicated cron with an @api.autovacuum method, which is the "odoo-way" of cleaning these things anyways