Skip to content

fix(redis): loop SCAN until keys found or cursor reaches zero to prevent empty result lockup - #926

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/920-redis-scan-empty-loop
Sep 23, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/920-redis-scan-empty-loop

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

In RedisKeysView._scanBatch(), SCAN cursor MATCH <pattern> COUNT 100 was previously executed only once per batch. When scanning large keyspaces with a filter pattern, Redis can return 0 matching keys alongside a non-zero cursor. Previously, when 0 keys were returned on initial load, _keys.isEmpty caused the view to render the "No keys found" placeholder and completely hid the ListView, hiding the "Load more" button and permanently locking the user out of the keyspace.

Changes

  • In RedisKeysView._scanBatch(), loop scan calls until at least some keys are discovered, cursor reaches 0, or a safety iteration limit is reached.
  • In RedisKeysView.build(), if _keys.isEmpty but _hasMore == true (cursor > 0), display a visible "Continue scanning" action in the empty state instead of permanently locking the UI.
  • Added comprehensive unit tests in test/features/redis/redis_keys_view_test.dart verifying empty-first-batch continuation and the "Continue scanning" flow.

Closes #920

@github-actions github-actions Bot added the bug Something isn't working label Sep 23, 2026
@github-actions github-actions Bot added this to the 0.4.18 milestone Sep 23, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit e58c5bd into dev Sep 23, 2026
4 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/920-redis-scan-empty-loop branch September 23, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant