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 #88

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

Conversation

nilshamerlinck
Copy link
Contributor

@nilshamerlinck nilshamerlinck commented Jun 12, 2024

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":

@OCA-git-bot
Copy link
Contributor

Hi @etobella, @simahawk,
some modules you are maintaining are being modified, check this out!

@nilshamerlinck nilshamerlinck force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch from 89a8317 to e885c6a Compare June 12, 2024 12:56
@nilshamerlinck nilshamerlinck changed the title [16.0][FIX] edi_storage_oca: don't silently ignore OSError/FileNotFoundError [FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError when getting remote file Jun 12, 2024
@nilshamerlinck nilshamerlinck changed the title [FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError when getting remote file [16.0][FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError when getting remote file Jun 12, 2024
@nilshamerlinck nilshamerlinck marked this pull request as draft June 12, 2024 13:00
@nilshamerlinck nilshamerlinck force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch from e885c6a to 7fccb13 Compare June 12, 2024 13:15
@nilshamerlinck nilshamerlinck changed the title [16.0][FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError when getting remote file [16.0][FIX] edi_storage_oca: do not silently ignore OSError/FileNotFoundError Jun 12, 2024
@nilshamerlinck nilshamerlinck force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch 2 times, most recently from a13626b to 3458c52 Compare June 12, 2024 13:20
@nilshamerlinck nilshamerlinck marked this pull request as ready for review June 12, 2024 13:27
@JordiMForgeFlow
Copy link
Contributor

@nilshamerlinck is there a reason why you don't keep the logging? Besides that, the changes look good to me and solve #70

@nilshamerlinck nilshamerlinck force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch from 3458c52 to 488e7c3 Compare June 12, 2024 13:53
@nilshamerlinck
Copy link
Contributor Author

good catch @JordiMForgeFlow I can definitely keep it for the raise_if_not_found=False case, fixed!

@simahawk simahawk assigned simahawk and unassigned simahawk Jun 13, 2024
@simahawk simahawk self-requested a review June 13, 2024 11:18
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

LG. Could you please take the chance to add a test for this? 🙏
Also, one consideration:

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

Wouldn't be better to raise a RetryableJobError then, instead of getting another job?

Of course, if we go this way we should go ahead w/ the fix on queue_job we discussed together regarding matching existing jobs when on error+retry counter>0 😉

@simahawk
Copy link
Contributor

@nilshamerlinck ping :)

nilshamerlinck and others added 3 commits July 26, 2024 17:20
- 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
@QuocDuong1306 QuocDuong1306 force-pushed the 16.0-fix-edi_storage_oca-dont_ignore branch from ece7106 to c5f835d Compare July 26, 2024 10:21
@nilshamerlinck
Copy link
Contributor Author

nilshamerlinck commented Jul 26, 2024

Hello @simahawk

  • @QuocDuong1306 just pushed commits that will apply the same retry logic for receive+process as for send: rely on the RetryableJobError mechanism instead of the scheduled action ("EDI exchange check input sync"), as per your suggestion
  • regarding the fix on queue_job, we went for a different approach:
  • thoughts welcome!

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.

6 participants