-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
[10.0] retry_postpone using new cursor #41
Conversation
job.store() | ||
env.cr.commit() | ||
|
||
job.env.cr.rollback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't you rollback only in case of errors? /cc @guewen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's there to prevent a conflict between the job.env's transaction and the new one. The job record might have been updated by the first one and will be updated by the second one? It's not called in the FailedJobError case though so why is it necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use this in production? Since when and do you see any side-effect?
job.store() | ||
env.cr.commit() | ||
|
||
job.env.cr.rollback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's there to prevent a conflict between the job.env's transaction and the new one. The job record might have been updated by the first one and will be updated by the second one? It's not called in the FailedJobError case though so why is it necessary here?
queue_job/jobrunner/runner.py
Outdated
@@ -188,7 +188,8 @@ def urlopen(): | |||
try: | |||
# we are not interested in the result, so we set a short timeout | |||
# but not too short so we trap and log hard configuration errors | |||
response = requests.get(url, timeout=1) | |||
# CGT: timeout must be hight enought to wait for server startup | |||
response = requests.get(url, timeout=15) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it required for you? What's your setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it and works fine
I didn't experience anymore
current transaction is aborted, commands ignored until end of transaction block
@yvaucher all unnecessary commits to this pull request have been reverted, sorry for the delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your contribution!
Note: to be squashed on merge |
If the job's transaction fail with an OperationalError such as a contraint failure, the transaction is broken and we will not be able to postpone the job. Open a new transaction to change the job's state. Port of: - OCA#41 from @2zx - OCA#130 from @liweijie0812
I've experienced this error
trying to requeue a job in case of a failure due to SQL errors (typically concurrency errors)
I think the problem can be solved with the use of a new cr as it is done in the case of a failed job