mobiletto 1.1.21 → 1.1.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util/redis.js +19 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "A storage layer that presents a uniform interface to Amazon S3, Backblaze B2, and local storage",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/util/redis.js CHANGED
@@ -131,13 +131,27 @@ class MobilettoCache {
131
131
  return await new Promise((resolve, reject) => {
132
132
  this.scanner.eachScan(pattern, {}, async (matchingKeys) => {
133
133
  for (const key of matchingKeys) {
134
- const val = await asyncFunc(key);
135
- if (typeof val !== 'undefined') {
136
- results.push(val)
137
- }
134
+ asyncFunc(key).then(
135
+ (val) => {
136
+ if (typeof val !== 'undefined') {
137
+ logger.debug(`applyToMatchingKeys: found key ${key} = ${val}`)
138
+ results.push(val)
139
+ } else {
140
+ logger.debug(`applyToMatchingKeys: found key with undefined value: ${key}`)
141
+ }
142
+ },
143
+ (e) => {
144
+ const message = `applyToMatchingKeys: error with key ${key}: ${e}`;
145
+ logger.error(message)
146
+ reject(message)
147
+ })
138
148
  }
139
149
  }, (err, matchCount) => {
140
- if (err) reject(err)
150
+ if (err) {
151
+ logger.error(`applyToMatchingKeys: error in final callback: ${err}`)
152
+ reject(err)
153
+ }
154
+ logger.error(`applyToMatchingKeys: resolving and returning ${results.length} results`)
141
155
  resolve(results)
142
156
  })
143
157
  })