feat(redis): improve pagination and filtering logic in getRowsFromTable method#1442
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves the Redis data access layer by enhancing null-safety for settings handling, fixing a bug in search field resolution, and improving pipeline result handling. The main changes include introducing defensive checks for the settings parameter and correctly using the table name when fetching table structure for search operations.
Key changes:
- Added
safeSettingsdefensive wrapper to handle null/undefined settings - Fixed bug where
row.keywas incorrectly used instead oftableNamewhen fetching table structure for search fields - Improved pipeline result handling to support both array and non-array response formats
Comments suppressed due to low confidence (1)
shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts:691
- This guard always evaluates to false.
result = rowValue === null || rowValue === undefined || rowValue === '';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The removal of early exit logic means the code now always scans the entire Redis keyspace, even when only a small page of results is needed. This can significantly impact performance for large datasets.
Consider re-implementing early exit logic, but fix the original bug where the condition cursor === '0' prevented it from working correctly. A better approach would be to break when allRows.length >= (page * perPage) + perPage, which ensures we have enough rows to satisfy the current page request.
| } | |
| } | |
| // Early exit: break if we have enough rows for the requested page | |
| if (allRows.length >= (page * perPage) + perPage) { | |
| break; | |
| } |
No description provided.