mobiletto 1.1.22 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/util/redis.js +13 -3
package/package.json
CHANGED
package/util/redis.js
CHANGED
|
@@ -128,22 +128,32 @@ class MobilettoCache {
|
|
|
128
128
|
|
|
129
129
|
applyToMatchingKeys = async (pattern, asyncFunc) => {
|
|
130
130
|
const results = []
|
|
131
|
+
const start = Date.now()
|
|
131
132
|
return await new Promise((resolve, reject) => {
|
|
132
133
|
this.scanner.eachScan(pattern, {}, async (matchingKeys) => {
|
|
133
134
|
for (const key of matchingKeys) {
|
|
134
135
|
asyncFunc(key).then(
|
|
135
136
|
(val) => {
|
|
136
137
|
if (typeof val !== 'undefined') {
|
|
138
|
+
logger.silly(`applyToMatchingKeys: found key ${key} = ${val}`)
|
|
137
139
|
results.push(val)
|
|
140
|
+
} else {
|
|
141
|
+
logger.silly(`applyToMatchingKeys: found key with undefined value: ${key}`)
|
|
138
142
|
}
|
|
139
143
|
},
|
|
140
144
|
(e) => {
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
const message = `applyToMatchingKeys: error with key ${key}: ${e}`;
|
|
146
|
+
logger.error(message)
|
|
147
|
+
reject(message)
|
|
143
148
|
})
|
|
144
149
|
}
|
|
145
150
|
}, (err, matchCount) => {
|
|
146
|
-
if (err)
|
|
151
|
+
if (err) {
|
|
152
|
+
logger.error(`applyToMatchingKeys: error in final callback: ${err}`)
|
|
153
|
+
reject(err)
|
|
154
|
+
}
|
|
155
|
+
const duration = Date.now() - start
|
|
156
|
+
logger.debug(`applyToMatchingKeys: resolving and returning ${results.length} results in ${duration/1000} seconds`)
|
|
147
157
|
resolve(results)
|
|
148
158
|
})
|
|
149
159
|
})
|