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

[16.0][FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError #150

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from

Conversation

santostelmo
Copy link
Contributor

Depends on OCA/queue#674

if an OSError is raised, there can be different cases but it's likely a transient issue (e.g. connection error):

if we ignore it as currently:
Job won't fail
the exchange record will be incorrectly marked as "input_received" but with no data, which is not what we want
so we don't ignore it anymore:
Job will fail;
the record state will stay as "input_pending" (as exception won't be catched in edi.backend:exchange_receive)
and as such, another action_exchange_receive Job will be created next time scheduled action "EDI exchange check input sync" runs, to try again to receive it, hopefully successfully this time
a RetryableJobError will be raised in order to retry it
if it sill can't succeed after max_retries, record state will be changed to "input_receive_error"
if a FileNotFoundError is raised, it's not a transient issue, so record should be marked as "input_receive_error":

to do so we don't ignore it anymore:
it will get catched in edi.backend:exchange_receive as a "swallable" (Final) error
record state will be changed to "input_receive_error"

nilshamerlinck and others added 3 commits March 20, 2025 07:26
- by default, _get_remote_file will still ignore FileNotFoundError
  when used for checks purpose
- but not when actually getting remote file to get processed

Co-authored-by: JordiMForgeFlow <[email protected]>
when a non-final error occurs, the exception is raised (e.g. OSError), for `Receive` exchange:

- the job fails

- the record state stays as "input_pending"

- another action_exchange_receive Job will be created next time scheduled action "EDI exchange check input sync" runs, to try again to receive it, hopefully successfully this time

we want to change it to rely more on the RetryableJobError mechanism than on the "EDI exchange check input sync" scheduled action
@santostelmo santostelmo force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch from c5f835d to 4ce734c Compare March 20, 2025 06:27
@@ -332,6 +332,42 @@ def action_exchange_receive(self):
self.ensure_one()
return self.backend_id.exchange_receive(self)

def action_exchange_send_on_max_retries_reached(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

These methods should be renamed based on the new implementation on qjob side.
They should be private BTW.

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.

4 participants