mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] forwardport: processing queue reliability
The queue would get items to process one at a time, process, commit, and go to the next. However this is an issue if one of the item fails systematically for some reason (aka it's not just a transient failure): the cron fails, then restarts at the exact same point, and fails again with the same issue, leading to following items never getting processed. Fix by getting all the queue contents at once, processing them one by one and "skipping" any item which fails (leaving it in place so it can get re-processed later). That way, even if an item causes issues, the rest of the queue gets processed normally. The interruption was an issue following odoo/enterprise#5670 not getting properly updated in the backend (backend didn't get notified of the last two updates / force-push to the PR, so it was trying to forward-port a commit which didn't exist - and failing).
This commit is contained in:
parent
fafa7ef437
commit
557878afe9
@ -14,16 +14,14 @@ class Queue:
|
||||
raise NotImplementedError
|
||||
|
||||
def _process(self):
|
||||
while True:
|
||||
b = self.search([], limit=1)
|
||||
if not b:
|
||||
return
|
||||
|
||||
b._process_item()
|
||||
|
||||
b.unlink()
|
||||
self.env.cr.commit()
|
||||
|
||||
for b in self.search([]):
|
||||
try:
|
||||
with self.env.cr.savepoint():
|
||||
b._process_item()
|
||||
b.unlink()
|
||||
self.env.cr.commit()
|
||||
except Exception:
|
||||
_logger.exception("Error while processing %s, skipping", b)
|
||||
|
||||
class BatchQueue(models.Model, Queue):
|
||||
_name = 'forwardport.batches'
|
||||
|
Loading…
Reference in New Issue
Block a user