diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-06-21 16:40:37 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-06-21 16:40:37 -0400 |
commit | 4fc120c971eff987ed15e4387c18426d837d6dbd (patch) | |
tree | b662bb94d52e97c7f7f5a24e173b1f3c271537fa | |
parent | 2eabee3c7172e598c1f304a22b7b464e5ae40582 (diff) | |
download | b4-4fc120c971eff987ed15e4387c18426d837d6dbd.tar.gz |
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 <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
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) |