[18.0][IMP] queue_job: Implement on fail hook - #971
Open
simahawk wants to merge 1 commit into
Open
Conversation
Allows to execute a model function when the job fails and will not be retried. [REF] queue_job: Move on fail definition to job function Rename on_fail_hook to on_fail
Contributor
guewen
approved these changes
Aug 27, 2026
SilvioC2C
approved these changes
Aug 27, 2026
Comment on lines
+13
to
+19
| def setUp(cls): | ||
| super().setUp() | ||
|
|
||
| def _clean_queue_job(): | ||
| cls.env["queue.job"].search([]).unlink() | ||
|
|
||
| cls.addCleanup(_clean_queue_job) |
Contributor
There was a problem hiding this comment.
Nitpicking: isn't this equivalent to:
Suggested change
| def setUp(cls): | |
| super().setUp() | |
| def _clean_queue_job(): | |
| cls.env["queue.job"].search([]).unlink() | |
| cls.addCleanup(_clean_queue_job) | |
| def tearDown(self): | |
| self.env["queue.job"].search([]).unlink() | |
| super().tearDown() |
Also, setUp is not decorated via @classmethod, so its first argument should be self
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #955
Allows to execute a model function when the job fails and will not be retried.