[19.0][FIX] edi_core_oca: Set exchange record as failed after max retries - #323
[19.0][FIX] edi_core_oca: Set exchange record as failed after max retries#323grindtildeath wants to merge 1 commit into
Conversation
simahawk
left a comment
There was a problem hiding this comment.
I don't really like this implementation as #321.
First of all we should consider if it really make sense: the state of the job is not the state of the record and we cannot assume that this behavior will be ok for everybody.
Second, we should consider other options rather than trying to guess a state by looking for jobs.
The first ones that come to my mind:
- by design the job function handle the state -> you can do this in your own function
- catch
FailedJobError, check__cause__attribute to see if it's an instance ofRetryableJobError(set by thefromdirective) - improve
job.performto raise a specificMaxRetryErrorand catch directly
https://github.com/OCA/queue/blob/18.0/queue_job/job.py#L506
There might be other ways as well that I don't see at the moment 👼
|
I've made a quick draft for opt 3 OCA/queue#954 |
|
@simahawk the issue with using a specific exception type for max retries reached is that such exception will never reach the code being executed by the queue job. Hence this is why I went with an "on fail hook" in OCA/queue#955 that is used by #324 to supersede this PR. |
No description provided.