refactor: remove key type check in DataAccessObjectRedis#1462
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes a conditional check that filters out Redis keys with type 'none' in the getTablesFromDB() method. The change comments out the validation that prevented non-existent keys from being added to the standalone keys array.
Key Changes:
- Commented out the
if (keyType !== 'none')condition check - All keys returned by
redisClient.type()will now be pushed tostandaloneKeys, including those with type'none'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // if (keyType !== 'none') { | ||
| standaloneKeys.push({ key, type: keyType }); | ||
| // } |
There was a problem hiding this comment.
Removing this check will cause non-existent keys to be included in the results. In Redis, the TYPE command returns 'none' when a key doesn't exist. This can happen due to a race condition: a key could be deleted between the keys('*') call on line 818 and the type(key) call on line 828. Without this check, tables with names like [none]deleted_key would be created for keys that no longer exist, which would lead to incorrect table listings.
| // if (keyType !== 'none') { | |
| standaloneKeys.push({ key, type: keyType }); | |
| // } | |
| if (keyType !== 'none') { | |
| standaloneKeys.push({ key, type: keyType }); | |
| } |
No description provided.