OCA / queue

Asynchronous Job Queue
GNU Affero General Public License v3.0
175 stars 451 forks source link

[14.0] queue_job_cron_jobrunner: avoid concurrent access on ir.cron #611

Closed petrus-v closed 5 months ago

petrus-v commented 8 months ago

As odoo add a lock while running cron task we should only try to write on it. If the cron is running while create new queue job records we will wait next call.

petrus-v commented 8 months ago

@ivantodorovich did you get similar issue on your odoo instances ?

ivantodorovich commented 8 months ago

@ivantodorovich did you get similar issue on your odoo instances ?

Hey @petrus-v , @damdam-s 👋🏻 it's nice to see your names here

Actually, I originally developed this module for Odoo 15.0, relying on cron triggers. It was later backported to 14.0 by @chrisb-c01 (https://github.com/OCA/queue/pull/479). Instead of using cron triggers, it uses this nextcall field.

I've never used this module in 14.0, though 😓

petrus-v commented 8 months ago

@ivantodorovich did you get similar issue on your odoo instances ?

Hey @petrus-v , @damdam-s 👋🏻 it's nice to see your names here

Actually, I originally developed this module for Odoo 15.0, relying on cron triggers. It was later backported to 14.0 by @chrisb-c01 (#479). Instead of using cron triggers, it uses this nextcall field.

I've never used this module in 14.0, though 😓

Thanks for your prompt reply, history regarding this topic and review !

Always a pleasure to see your name on so many projects around ! see you soon and happy end of year :)

OCA-git-bot commented 8 months ago

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

gurneyalex commented 8 months ago

are you aware of https://github.com/OCA/queue/pull/612?

petrus-v commented 8 months ago

are you aware of #612?

no I'm not... but I'm not sure how much it's related. As mentionned by @ivantodorovich this module in version 14.0 do not rely on ir.cron.trigger which exists from version 15.0.

So creating a new job in this version try to write on the ir.cron which is probably running to the row is lock, at the end the whole transaction get rollback before this PR.

OCA-git-bot commented 5 months ago

What a great day to merge this nice PR. Let's do it! Prepared branch 14.0-ocabot-merge-pr-611-by-guewen-bump-patch, awaiting test results.

OCA-git-bot commented 5 months ago

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