Skip to content

Commit

Permalink
Merge PR #726 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by sbidoul
  • Loading branch information
OCA-git-bot committed Dec 27, 2024
2 parents 96ea979 + 1a16788 commit 229e20b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions queue_job/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from psycopg2 import OperationalError, errorcodes
from werkzeug.exceptions import BadRequest, Forbidden

from odoo import SUPERUSER_ID, _, api, http, registry
from odoo import SUPERUSER_ID, _, api, http
from odoo.modules.registry import Registry
from odoo.service.model import PG_CONCURRENCY_ERRORS_TO_RETRY

from ..delay import chain, group
Expand Down Expand Up @@ -79,7 +80,7 @@ def runjob(self, db, job_uuid, **kw):

def retry_postpone(job, message, seconds=None):
job.env.clear()
with registry(job.env.cr.dbname).cursor() as new_cr:
with Registry(job.env.cr.dbname).cursor() as new_cr:
job.env = api.Environment(new_cr, SUPERUSER_ID, {})
job.postpone(result=message, seconds=seconds)
job.set_pending(reset_retry=False)
Expand Down Expand Up @@ -130,7 +131,7 @@ def retry_postpone(job, message, seconds=None):
traceback_txt = buff.getvalue()
_logger.error(traceback_txt)
job.env.clear()
with registry(job.env.cr.dbname).cursor() as new_cr:
with Registry(job.env.cr.dbname).cursor() as new_cr:
job.env = job.env(cr=new_cr)
vals = self._get_failure_values(job, traceback_txt, orig_exception)
job.set_failed(**vals)
Expand Down

0 comments on commit 229e20b

Please sign in to comment.