From 9757b3a628fc124d2afb3c4b0077f52124c5085b Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Tue, 16 Jun 2026 15:47:32 +0300 Subject: [PATCH] perf(redis): query key types and TTLs concurrently during scan Improves key scanning performance by querying type and TTL of scanned keys concurrently using rather than sequential network requests. --- lib/features/redis/redis_keys_view.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/features/redis/redis_keys_view.dart b/lib/features/redis/redis_keys_view.dart index afaedb4b..48e7d25e 100644 --- a/lib/features/redis/redis_keys_view.dart +++ b/lib/features/redis/redis_keys_view.dart @@ -76,17 +76,17 @@ class _RedisKeysViewState extends material.State { count: 100, ); - // Fetch type and TTL for each key - final infos = <_KeyInfo>[]; - for (final name in keyNames) { + // Fetch type and TTL for each key concurrently + final futures = keyNames.map((name) async { try { final type = await widget.connection.keyType(name); final ttl = await widget.connection.ttl(name); - infos.add(_KeyInfo(name: name, type: type, ttl: ttl)); + return _KeyInfo(name: name, type: type, ttl: ttl); } catch (_) { - infos.add(_KeyInfo(name: name, type: 'unknown', ttl: -1)); + return _KeyInfo(name: name, type: 'unknown', ttl: -1); } - } + }); + final infos = await Future.wait(futures); if (!mounted) return; setState(() {