[FIX] forwardport: queue reliability changes

Previous version would break if _process_item itself committed which
was bad
This commit is contained in:
Xavier Morel 2019-10-11 09:02:50 +02:00
parent 3ce3dd9569
commit bad016b830

View File

@ -2,8 +2,6 @@
import logging
from contextlib import ExitStack
import subprocess
from odoo import fields, models
@ -16,12 +14,13 @@ class Queue:
def _process(self):
for b in self.search([]):
try:
with self.env.cr.savepoint():
b._process_item()
b._process_item()
b.unlink()
self.env.cr.commit()
except Exception:
_logger.exception("Error while processing %s, skipping", b)
self.env.cr.rollback()
self.clear_caches()
class BatchQueue(models.Model, Queue):
_name = 'forwardport.batches'