mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] forwardport: queue reliability changes
Previous version would break if _process_item itself committed which was bad
This commit is contained in:
parent
3ce3dd9569
commit
bad016b830
@ -2,8 +2,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from contextlib import ExitStack
|
from contextlib import ExitStack
|
||||||
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
@ -16,12 +14,13 @@ class Queue:
|
|||||||
def _process(self):
|
def _process(self):
|
||||||
for b in self.search([]):
|
for b in self.search([]):
|
||||||
try:
|
try:
|
||||||
with self.env.cr.savepoint():
|
b._process_item()
|
||||||
b._process_item()
|
|
||||||
b.unlink()
|
b.unlink()
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
_logger.exception("Error while processing %s, skipping", b)
|
_logger.exception("Error while processing %s, skipping", b)
|
||||||
|
self.env.cr.rollback()
|
||||||
|
self.clear_caches()
|
||||||
|
|
||||||
class BatchQueue(models.Model, Queue):
|
class BatchQueue(models.Model, Queue):
|
||||||
_name = 'forwardport.batches'
|
_name = 'forwardport.batches'
|
||||||
|
Loading…
Reference in New Issue
Block a user