Browse Source

Warn, log, and continue on conflict query failure

If Gerrit returns an error with the conflict query when syncing
a change, warn the user and log, but do not fail.

Change-Id: I75302e3b9b485cb2c1b52b6dda0f68fb0a6fe450
James E. Blair 2 years ago
parent
commit
7016d319e7
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      gertty/sync.py

+ 9
- 2
gertty/sync.py View File

@@ -23,6 +23,7 @@ import threading
23 23
 import json
24 24
 import time
25 25
 import datetime
26
+import warnings
26 27
 
27 28
 import dateutil.parser
28 29
 try:
@@ -588,8 +589,14 @@ class SyncChangeTask(Task):
588 589
         for remote_commit, remote_revision in remote_change.get('revisions', {}).items():
589 590
             remote_comments_data = sync.get('changes/%s/revisions/%s/comments' % (self.change_id, remote_commit))
590 591
             remote_revision['_gertty_remote_comments_data'] = remote_comments_data
591
-        remote_conflicts = sync.query(['q=status:open+is:mergeable+conflicts:%s' %
592
-                                       remote_change['_number']])
592
+        try:
593
+            remote_conflicts = sync.query(['q=status:open+is:mergeable+conflicts:%s' %
594
+                                           remote_change['_number']])
595
+        except Exception:
596
+            self.log.exception("Unable to sync conflicts for change %s" % self.change_id)
597
+            warnings.warn("Unable to sync conflicts for change %s" % self.change_id)
598
+            remote_conflicts = []
599
+
593 600
         fetches = collections.defaultdict(list)
594 601
         parent_commits = set()
595 602
         with app.db.getSession() as session:

Loading…
Cancel
Save