From 40d329e74d5497e9327c8173844a3d60afce01ea Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 19:39:21 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt=20Optimization:=20Use=20chunke?= =?UTF-8?q?d=20MGET=20for=20Redis=20hydration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: d3mocide <136547209+d3mocide@users.noreply.github.com> --- poller/pollers/adsb.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/poller/pollers/adsb.py b/poller/pollers/adsb.py index 54aa42d..1528c97 100644 --- a/poller/pollers/adsb.py +++ b/poller/pollers/adsb.py @@ -95,13 +95,20 @@ async def _hydrate_from_redis(self) -> None: keys = [] cur = 0 while True: - cur, batch = await r.scan(cur, match="entity:*", count=200) + # ⚡ Bolt Optimization: Increase SCAN count to 5000 to drastically reduce round-trips + cur, batch = await r.scan(cur, match="entity:*", count=5000) keys.extend(batch) if not cur: break + + results = [] + # ⚡ Bolt Optimization: Use MGET in chunks instead of individual GETs + for i in range(0, len(keys), 5000): + chunk = await r.mget(keys[i:i + 5000]) + results.extend(chunk) + hydrated = 0 - for key in keys: - raw = await r.get(key) + for raw in results: if not raw: continue # ⚡ Bolt Optimization: Fast bytes matching to bypass JSON parsing for non-aircraft entities (~35x faster for skips)