Skip to content

[19.0][FIX] edi_queue_oca: propagate failed jobs to exchanges#321

Open
yankinmax wants to merge 1 commit into
OCA:19.0from
camptocamp:fix-edi_queue_oca
Open

[19.0][FIX] edi_queue_oca: propagate failed jobs to exchanges#321
yankinmax wants to merge 1 commit into
OCA:19.0from
camptocamp:fix-edi_queue_oca

Conversation

@yankinmax

Copy link
Copy Markdown
Contributor

When an EDI queue job reached its maximum retries, only the queue job was marked as failed while the related exchange remained pending.

Propagate terminal send, receive, and process job failures to the corresponding exchange error state, including the exception message and traceback.

When an EDI queue job reached its maximum retries, only the queue job
was marked as failed while the related exchange remained pending.

Propagate terminal send, receive, and process job failures to the
corresponding exchange error state, including the exception message
and traceback.
@yankinmax

Copy link
Copy Markdown
Contributor Author

Hello @simahawk can you pls take a look?


def write(self, vals):
result = super().write(vals)
if vals.get("state") == "failed":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe there’s an opportunity to create an "on-failure" hook in the queue_job module

https://github.com/OCA/queue/blob/19.0/queue_job/models/queue_job.py#L268

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FWIW when the job is failing, only the job object will be updated through a dedicated function for failure,
and then the modified values are going to be stored on the odoo record: https://github.com/OCA/queue/blob/19.0/queue_job/controllers/main.py#L187-L188

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On fail hooks in queue job: OCA/queue#955


def write(self, vals):
result = super().write(vals)
if vals.get("state") == "failed":

@Ricardoalso Ricardoalso Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Direct SQL updates executed by the queue_job runner will bypass this logic https://github.com/OCA/queue/blob/19.0/queue_job/jobrunner/runner.py#L217

In the situation where the number of retries exceeds the maximum allowed, the job is marked as "failed" with the error "JobFoundDead."

@grindtildeath grindtildeath left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Idea looks good, but IMO there's still something wrong because:


def write(self, vals):
result = super().write(vals)
if vals.get("state") == "failed":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FWIW when the job is failing, only the job object will be updated through a dedicated function for failure,
and then the modified values are going to be stored on the odoo record: https://github.com/OCA/queue/blob/19.0/queue_job/controllers/main.py#L187-L188

Comment on lines +18 to +22
supported_methods = {
"action_exchange_process",
"action_exchange_receive",
"action_exchange_send",
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why don't we have action_exchange_generate

I'd suggest to have a constant variable with the functions list, so that it can be relied on here and in the _register_hook.

@grindtildeath

Copy link
Copy Markdown
Contributor

Here's another attempt at solving the same issue: #323

@simahawk simahawk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not a viable solution

@grindtildeath

Copy link
Copy Markdown
Contributor

Alternative implementation: #324

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants