From 4fc120c971eff987ed15e4387c18426d837d6dbd Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 21 Jun 2022 16:40:37 -0400 Subject: Dedupe msgid list We don't want to use the set() here, since we want to preserve the order, so use an auxiliary set for dupe tracking. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/b4/__init__.py b/b4/__init__.py index cfbe6a6..42d755f 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2625,7 +2625,10 @@ def patchwork_set_state(msgids: List[str], state: str) -> bool: pses, url = get_patchwork_session(pwkey, pwurl) patches_url = '/'.join((url, 'patches')) tochange = list() + seen = set() for msgid in msgids: + if msgid in seen: + continue # Two calls, first to look up the patch-id, second to update its state params = [ ('project', pwproj), @@ -2642,6 +2645,7 @@ def patchwork_set_state(msgids: List[str], state: str) -> bool: if patch_id: title = entry.get('name') if entry.get('state') != state: + seen.add(msgid) tochange.append((patch_id, title)) except requests.exceptions.RequestException as ex: logger.debug('Patchwork REST error: %s', ex) -- cgit v1.2.3