Skip to content

REFACTOR Make queue_job dependencies optional#2105

Open
ecino wants to merge 1 commit into
18.0from
ecino/queue-job-sh
Open

REFACTOR Make queue_job dependencies optional#2105
ecino wants to merge 1 commit into
18.0from
ecino/queue-job-sh

Conversation

@ecino

@ecino ecino commented Jun 25, 2026

Copy link
Copy Markdown
Member
  • NEW module queue_job_sh_safe that will safely use queue_jobs when available and fallback to an alternate mechanism with ir_cron in case the module is not installed.
  • This is useful for Nordic using odoo.sh on which queue jobs are prohibited and not optimal for the infrastructure

gemini-code-assist[bot]

This comment was marked as resolved.

@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Confidence Score: 3/5

The fallback queue path still needs attention around replacement jobs that receive follow-up work while already running.

  • The core optional-queue fallback can enqueue and execute a simple job through the replacement cron path.
  • The identity-key merge behavior can lose work when a running replacement job receives additional record ids after cron has already materialized its recordset.
  • The changes touch many asynchronous call sites, so correctness depends on the replacement queue preserving delivery semantics under concurrent or repeated scheduling.

queue_job_optional/models/queue_job_replacement.py

T-Rex T-Rex Logs

What T-Rex did

  • Reviewed the initial environment state, noting that HEAD^ lacks queue_job_optional/models/base.py and that importing Odoo is not possible.
  • After enqueue, the log shows the queue job availability as False, one replacement was created, cron was triggered, and the replacement moved from pending to done with the job_result executed:[11]:alpha:42.
  • After cron, the cron-run path was executed and showed the system moving from pending/None to done/executed-by-cron:[11]:alpha:42.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (15): Last reviewed commit: "REFACTOR Make queue_job dependencies opt..." | Re-trigger Greptile

Comment thread queue_job_sh_safe/security/ir.model.access.csv Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 07f6d5f to a0cad46 Compare June 25, 2026 18:40
Comment thread queue_job_sh_safe/security/ir.model.access.csv Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_optional/models/queue_job_replacement.py
Comment thread partner_communication/__manifest__.py Outdated
Comment thread message_center_compassion/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from a0cad46 to e2d8348 Compare June 25, 2026 19:08
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread partner_communication/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from e2d8348 to 51f4a7d Compare June 29, 2026 08:32
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread partner_communication/models/ir_actions.py
Comment thread message_center_compassion/__manifest__.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 51f4a7d to bda7e87 Compare June 29, 2026 09:19
Comment thread gift_compassion/models/account_move_line.py Outdated
Comment thread queue_job_optional/models/base.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from bda7e87 to c7688c2 Compare June 29, 2026 09:41
Comment thread queue_job_optional/models/base.py
Comment thread child_compassion/models/child_compassion.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from c7688c2 to 5959cc9 Compare June 29, 2026 09:54
Comment thread partner_communication_reminder/models/recurring_contract.py
Comment thread partner_communication/models/communication_job.py
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 5959cc9 to 9b2f73a Compare June 29, 2026 10:15
Comment thread queue_job_sh_safe/models/base.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 9b2f73a to 28c5143 Compare June 29, 2026 11:45
Comment thread queue_job_optional/models/base.py
@ecino ecino force-pushed the ecino/queue-job-sh branch 2 times, most recently from f21d9e3 to b886b0a Compare June 29, 2026 12:31
@ecino ecino changed the title [WIP] FEAT! Make queue_job dependencies optional REFACTOR Make queue_job dependencies optional Jun 29, 2026
@ecino ecino marked this pull request as ready for review June 29, 2026 12:31
Comment thread queue_job_optional/models/base.py
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from b886b0a to ff7a2b5 Compare June 29, 2026 13:24
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from ff7a2b5 to 1f482b5 Compare June 29, 2026 13:35
Comment thread queue_job_optional/models/queue_job_replacement.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from 1f482b5 to fff7252 Compare June 29, 2026 13:48
Comment thread queue_job_optional/models/queue_job_replacement.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from fff7252 to e577373 Compare June 29, 2026 14:26
Comment thread partner_communication_reminder/models/recurring_contract.py
- NEW module queue_job_sh_safe that will safely use queue_jobs when available and fallback to an alternate mechanism with ir_cron in case the module is not installed.
- This is useful for Nordic using odoo.sh on which queue jobs are prohibited and not optimal for the infrastructure
@ecino ecino force-pushed the ecino/queue-job-sh branch from e577373 to 07cdaba Compare June 29, 2026 14:39
pending_job = self.search(
[
("identity_key", "=", identity_key),
("state", "in", ["pending", "processing"]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Processing Jobs Swallow Follow-Ups

When a second job with the same identity_key is queued while the first one is already processing, this branch merges the new res_ids into the row that cron is currently executing and returns it instead of creating pending work. The running cron already browsed the old ids and then marks the row done, so the newly merged ids are never executed for stable-key callers such as communication automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant