Skip to content

Commit bad91e3

Browse files
author
Olaf Kwant
committed
store the promises
1 parent 2f19669 commit bad91e3

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/client_v2.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ export default class ClientV2 extends Client {
6262
delete obj.cachable
6363
var cacheName = tools.unqiue(obj)
6464

65-
if (cached) {
66-
var currently = tools.cache(cacheName)
67-
if (currently !== undefined) return Promise.resolve(currently)
68-
}
69-
70-
return Client.prototype.request.call(this, obj).then((data) => {
71-
if (cached) tools.cache(cacheName, data)
72-
return data
73-
})
65+
if (cached) return tools.cache(cacheName) || tools.cache(cacheName, super.request(obj))
66+
else return super.request(obj)
7467
}
7568
}

0 commit comments

Comments
 (0)