Skip to content
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

[12.0][FIX] Autovacuum cron job #163

Closed
wants to merge 3 commits into from

Conversation

@naglis
Copy link
Contributor

commented Aug 3, 2019

state is not set to code on the AutoVacuum Job Queue ir.cron data record, so the default action object_write is assigned to it on creation, as a result, the cron job does nothing when it runs (jobs older than 30 days are not being deleted).

Affected versions: 12.0, this was already fixed for 11.0 in #112

I've also added a test case and a migration to update the record for existing installations (since the record is marked as noupdate="1").

If, like me, you did not notice it for quite a while and now have hundreds of thousands of old jobs (or even more), running the fixed autovacuum cron job will most likely fail due to memory error or a timeout (depends on the setup, of course). To work around that, I've copied the original AutoVacuum Job Queue cron job record and used this for code:

deadline = datetime.datetime.now() - datetime.timedelta(days=31)
model.search([('date_done', '<=', deadline)], limit=10000).unlink()

and setup to run this Cron job e.g. every 5 minutes to clear away the build-up.

naglis added 3 commits Aug 3, 2019
@guewen
guewen approved these changes Aug 6, 2019
Copy link
Member

left a comment

Thanks for this PR of quality and the detailed description!

@sebalix
sebalix approved these changes Aug 6, 2019
Copy link

left a comment

Approving, but should we instead cherry-pick a89d1d8 regarding the XML data?

@OCA-git-bot OCA-git-bot added the approved label Aug 6, 2019
@pedrobaeza pedrobaeza added this to the 12.0 milestone Aug 6, 2019
Copy link
Member

left a comment

I think it's OK as it is

@guewen

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

/ocabot merge

@OCA-git-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2019

This PR looks fantastic, let's merge it!
Rebased to 12.0-ocabot-merge-pr-163-by-guewen-bump-no, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Aug 8, 2019
Signed-off-by guewen
@OCA-git-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2019

Congratulations, your PR was merged at 380007c. Thanks a lot for contributing to OCA. ❤️

PS: Don't worry if GitHub says there are unmerged commits: it is due to a rebase before merge. All commits of this PR have been merged into 12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.