From 0cd587fce7968e51118150f97e0ee6aee9455494 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 28 Feb 2019 17:14:57 +0100 Subject: [PATCH] [FIX] runbot_merge: don't blow the fetch loop when a PR has no label No test because I don't understand how / why it's triggered, it's just that some PRs don't have a label. I assumed the issue occurred when the source branch or even repo (cross-repo PR) was deleted, but it doesn't seem to trigger the issue (or in any case not in as short a time as a test, maybe GH eventually does some vacuuming which causes the issue? Anyway we may eventually want to reclaim these PRs (allowing a lack of label and treating them like the patch-\d labels: with no semantic value) however the simplest thing to do for now is to just ignore the corresponding PR. closes #101 --- runbot_merge/models/pull_requests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 4ba6bf39..b7907422 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -148,7 +148,13 @@ class Project(models.Model): if not f: return - f.repository._load_pr(f.number) + self.env.cr.execute("SAVEPOINT runbot_merge_before_fetch") + try: + f.repository._load_pr(f.number) + except Exception: + self.env.cr.execute("ROLLBACK TO SAVEPOINT runbot_merge_before_fetch") + _logger.exception("Failed to load pr %s, skipping it", f.number) + self.env.cr.execute("RELEASE SAVEPOINT runbot_merge_before_fetch") # commit after each fetched PR f.active = False