From e76df05e7a6e4e455d4640fcadb976cff3fb6c11 Mon Sep 17 00:00:00 2001 From: PedroHMCosme Date: Tue, 22 Sep 2026 12:03:21 -0300 Subject: [PATCH] fix(gateway): suppress SonarQube S7504 false positive in close_all list() here isn't redundant: _evict() pops from self._connections, so iterating the dict directly would raise 'changed size during iteration'. NOSONAR + comment explaining why, per Sonar's own suppression convention already used in ingestor/app.py. --- ingestor/connection/pool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ingestor/connection/pool.py b/ingestor/connection/pool.py index 8e93542..73002f5 100644 --- a/ingestor/connection/pool.py +++ b/ingestor/connection/pool.py @@ -107,7 +107,9 @@ class OpcConnectionPool(SientiaMonitoring): async def close_all(self): """Disconnect every pooled client (e.g. on shutdown).""" - for server_id in list(self._connections): + # list() snapshots the keys: _evict() pops from self._connections, + # so iterating the dict directly would raise "changed size during iteration". + for server_id in list(self._connections): # NOSONAR await self._evict(server_id) async def _evict(self, server_id: str):