-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
The current router DB backend simply iterates over all keys in each backend, same with count. This isn't necessarily correct, because it doesn't take into account which keys would actually be used, based on the prefix configured.
async * iterKeys () {
for (const backend of new Set(Object.values(this.backends))) {
yield * backend.iterKeys()
}
}
async keyCount () {
let count = 0
for (const backend of new Set(Object.values(this.backends))) {
count += await backend.keyCount()
}
return count
}Example:
Configuration is:
[database.backendOptions.router]
"*" = { name = "fs", options = { } }
z = { name = "redis", options = { } }Say that redis has a key called foo. This would be reported both in iterKeys and keyCount, even though the redis backend will never be used for this key.
Solution
Improve the logic to report only relevant keys.
taoeffect
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working